summaryrefslogtreecommitdiffstats
path: root/examples/widgets/widgets/icons/mainwindow.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-01 09:56:28 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-14 19:20:06 +0000
commit8132cb655ad9f1479110d20c4f31f32a9da094d9 (patch)
treeff20cd03c881fc9180c08f366d555ac233a52294 /examples/widgets/widgets/icons/mainwindow.h
parentf3fd7b3d961ffed480e5851e594f6981f558f486 (diff)
Polish the Icons example.
- Remove unneeded member variables. - Use new connection syntax in createActions() to assemble the menu there, removing the createMenus() function. - Use a QButtonGroup for the sizes with the style metrics as id. - Streamline code, rename variables for clarity. - Introduce static functions returning the list of states/modes and their names in display order to IconPreviewArea, removing the duplicates. - Split actions to open sample icons provided from source directory or standard pictures location to make sample icons more prominently visible. - Check and display @2x images and add tooltips showing device pixel ratio and actual size. - HighDPI: Add groupbox displaying screen name and device pixel ratio, connect to screen changed signal and update icons panel accordingly. Add check box for toggling Qt::AA_UseHighDpiPixmaps. - Adjust documentation Task-number: QTBUG-18680 Task-number: QTBUG-46615 Change-Id: Ice96e9898f168ef2a30e9f46cb260ed57ae015f0 Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Diffstat (limited to 'examples/widgets/widgets/icons/mainwindow.h')
-rw-r--r--examples/widgets/widgets/icons/mainwindow.h49
1 files changed, 23 insertions, 26 deletions
diff --git a/examples/widgets/widgets/icons/mainwindow.h b/examples/widgets/widgets/icons/mainwindow.h
index 3628038878..207986f741 100644
--- a/examples/widgets/widgets/icons/mainwindow.h
+++ b/examples/widgets/widgets/icons/mainwindow.h
@@ -49,9 +49,10 @@
QT_BEGIN_NAMESPACE
class QAction;
class QActionGroup;
-class QGroupBox;
+class QLabel;
class QMenu;
class QRadioButton;
+class QButtonGroup;
class QTableWidget;
QT_END_NAMESPACE
class IconPreviewArea;
@@ -65,51 +66,47 @@ class MainWindow : public QMainWindow
public:
MainWindow();
+ void loadImages(const QStringList &fileNames);
+
+ void show();
+
private slots:
void about();
void changeStyle(bool checked);
- void changeSize(bool checked = true);
+ void changeSize(int, bool);
+ void triggerChangeSize();
void changeIcon();
- void addImages();
+ void addSampleImages();
+ void addOtherImages();
void removeAllImages();
+ void useHighDpiPixmapsChanged(int checkState);
+ void screenChanged();
private:
- void createPreviewGroupBox();
- void createImagesGroupBox();
- void createIconSizeGroupBox();
+ QWidget *createImagesGroupBox();
+ QWidget *createIconSizeGroupBox();
+ QWidget *createHighDpiIconSizeGroupBox();
void createActions();
- void createMenus();
void createContextMenu();
void checkCurrentStyle();
+ void addImages(const QString &directory);
- QWidget *centralWidget;
-
- QGroupBox *previewGroupBox;
IconPreviewArea *previewArea;
- QGroupBox *imagesGroupBox;
QTableWidget *imagesTable;
- QGroupBox *iconSizeGroupBox;
- QRadioButton *smallRadioButton;
- QRadioButton *largeRadioButton;
- QRadioButton *toolBarRadioButton;
- QRadioButton *listViewRadioButton;
- QRadioButton *iconViewRadioButton;
- QRadioButton *tabBarRadioButton;
- QRadioButton *otherRadioButton;
+ QButtonGroup *sizeButtonGroup;
IconSizeSpinBox *otherSpinBox;
- QMenu *fileMenu;
- QMenu *viewMenu;
- QMenu *helpMenu;
- QAction *addImagesAct;
+ QLabel *devicePixelRatioLabel;
+ QLabel *screenNameLabel;
+
+ QAction *addOtherImagesAct;
+ QAction *addSampleImagesAct;
QAction *removeAllImagesAct;
- QAction *exitAct;
QAction *guessModeStateAct;
+ QAction *nativeFileDialogAct;
QActionGroup *styleActionGroup;
- QAction *aboutAct;
- QAction *aboutQtAct;
};
//! [0]