Re: PCP Updates: RHBZ 1348349: pmchart(1): Table of metrics, instances and values

Nathan Scott <[email protected]>
Newsgroups gmane.comp.sysutils.pcp
Message-ID <[email protected]>
Hi Dave,

----- Original Message -----
> This is my first Qt creation using the qt designer tool. A review of all
> aspects is definitely warranted.
> 

Nice!  Getting there - handful of things I came across trying it ...

- there's a UI interaction "surprise" when clicking on a chart, while
multiple charts active (e.g. pmchart -c CPU -c Netbytes) - it pops up
multiple dialogs at once.  Should always only be one - the clicked-on
chart's metrics.

- should be using a QDialog here rather than a new QMainWindow I think
(allows dialog-OK button, which we also need here) - we don't need the
menu bar, status bar, etc of a QMainWindow in a QDialog;

- (re-)sizing of dialogs I always find tricky, and when I resize this
one, everything stays "static" - ideally the widgets would all resize
with the dialog window.  Have a look at the way saveviewdialog.ui does
this, e.g. when clicking+dragging on the window-manager-window see how
everything reshapes.

Attached patch switched to using QDialog, adds an OK button, and sets
up the table headings in the .ui file ... but breaks a bunch too.  And
I'm not sure how to get the resizing working correctly like we have in
saveviewdialog.ui - maybe you can see what I've missed there?  (also,
in designer you can use Ctrl+r - Run - to quickly test any changes to
a new window, if you hadn't found that already).

cheers.

--
Nathan

_______________________________________________
pcp mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/pcp
broken-dialog.patch (text/x-patch, 5.4 KB)
diff --git a/src/pmchart/metricdetails.cpp b/src/pmchart/metricdetails.cpp
index d1851df..851aa55 100644
--- a/src/pmchart/metricdetails.cpp
+++ b/src/pmchart/metricdetails.cpp
@@ -14,8 +14,7 @@
 #include "metricdetails.h"
 #include <QTableWidget>
 
-MetricDetailsWindow::MetricDetailsWindow(QWidget* parent) :
-    QMainWindow(parent)
+MetricDetailsWindow::MetricDetailsWindow(QWidget* parent) : QDialog(parent)
 {
     setupUi(this);
 
diff --git a/src/pmchart/metricdetails.h b/src/pmchart/metricdetails.h
index 8da90cd..0bc326d 100644
--- a/src/pmchart/metricdetails.h
+++ b/src/pmchart/metricdetails.h
@@ -15,7 +15,7 @@
 #define METRICDETAILS_H
 
 #include "ui_metricdetails.h"
-class MetricDetailsWindow : public QMainWindow, public Ui::MetricDetailsWindow
+class MetricDetailsWindow : public QDialog, public Ui::MetricDetailsWindow
 {
     Q_OBJECT
 
@@ -35,11 +35,6 @@ public slots:
 protected slots:
 
 private:
-#if 0
-     struct {
-	 int whatever;
-     } my;
-#endif
 };
 
 #endif	// METRICDETAILS_H
diff --git a/src/pmchart/metricdetails.ui b/src/pmchart/metricdetails.ui
index e8e8eba..cf3cfd1 100644
--- a/src/pmchart/metricdetails.ui
+++ b/src/pmchart/metricdetails.ui
@@ -1,58 +1,120 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
  <class>MetricDetailsWindow</class>
- <widget class="QMainWindow" name="MetricDetailsWindow">
+ <widget class="QDialog" name="MetricDetailsWindow">
+  <property name="windowModality">
+   <enum>Qt::WindowModal</enum>
+  </property>
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>300</height>
+    <width>521</width>
+    <height>337</height>
    </rect>
   </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
   <property name="windowTitle">
-   <string>PCP Charts - Selected Metric Details</string>
+   <string>Selected Metric Details</string>
+  </property>
+  <property name="layoutDirection">
+   <enum>Qt::LeftToRight</enum>
+  </property>
+  <property name="sizeGripEnabled">
+   <bool>true</bool>
   </property>
-  <widget class="QWidget" name="centralwidget">
-   <layout class="QGridLayout" name="gridLayout">
-    <item row="0" column="0">
-     <widget class="QTableWidget" name="tableWidget">
-      <property name="alternatingRowColors">
-       <bool>true</bool>
-      </property>
-      <property name="sortingEnabled">
-       <bool>true</bool>
-      </property>
-      <attribute name="horizontalHeaderCascadingSectionResizes">
-       <bool>false</bool>
-      </attribute>
-      <attribute name="horizontalHeaderShowSortIndicator" stdset="0">
-       <bool>true</bool>
-      </attribute>
-      <attribute name="horizontalHeaderStretchLastSection">
-       <bool>false</bool>
-      </attribute>
-      <attribute name="verticalHeaderVisible">
-       <bool>false</bool>
-      </attribute>
-      <attribute name="verticalHeaderStretchLastSection">
-       <bool>false</bool>
-      </attribute>
-     </widget>
-    </item>
-   </layout>
+  <widget class="QDialogButtonBox" name="buttonBox">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>300</y>
+     <width>499</width>
+     <height>30</height>
+    </rect>
+   </property>
+   <property name="standardButtons">
+    <set>QDialogButtonBox::Ok</set>
+   </property>
   </widget>
-  <widget class="QMenuBar" name="menubar">
+  <widget class="QTableWidget" name="tableWidget">
+   <property name="enabled">
+    <bool>true</bool>
+   </property>
    <property name="geometry">
     <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>400</width>
-     <height>27</height>
+     <x>10</x>
+     <y>10</y>
+     <width>501</width>
+     <height>278</height>
     </rect>
    </property>
+   <property name="alternatingRowColors">
+    <bool>true</bool>
+   </property>
+   <property name="sortingEnabled">
+    <bool>true</bool>
+   </property>
+   <property name="rowCount">
+    <number>1</number>
+   </property>
+   <property name="columnCount">
+    <number>5</number>
+   </property>
+   <attribute name="horizontalHeaderCascadingSectionResizes">
+    <bool>false</bool>
+   </attribute>
+   <attribute name="horizontalHeaderShowSortIndicator" stdset="0">
+    <bool>true</bool>
+   </attribute>
+   <attribute name="horizontalHeaderStretchLastSection">
+    <bool>false</bool>
+   </attribute>
+   <attribute name="verticalHeaderVisible">
+    <bool>false</bool>
+   </attribute>
+   <attribute name="verticalHeaderShowSortIndicator" stdset="0">
+    <bool>true</bool>
+   </attribute>
+   <attribute name="verticalHeaderStretchLastSection">
+    <bool>true</bool>
+   </attribute>
+   <row/>
+   <column>
+    <property name="text">
+     <string>Time</string>
+    </property>
+   </column>
+   <column>
+    <property name="text">
+     <string>Hostname</string>
+    </property>
+   </column>
+   <column>
+    <property name="text">
+     <string>Metric</string>
+    </property>
+   </column>
+   <column>
+    <property name="text">
+     <string>Instance</string>
+    </property>
+   </column>
+   <column>
+    <property name="text">
+     <string>Value</string>
+    </property>
+   </column>
+   <item row="0" column="0">
+    <property name="text">
+     <string/>
+    </property>
+   </item>
   </widget>
-  <widget class="QStatusBar" name="statusbar"/>
  </widget>
  <resources/>
  <connections/>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.