Beispiel #1
0
  public Icons() {
    centralWidget = new QWidget();
    setCentralWidget(centralWidget);

    createPreviewGroupBox();
    createImagesGroupBox();
    createIconSizeGroupBox();

    createActions();
    createMenus();
    createContextMenu();

    QGridLayout mainLayout = new QGridLayout();
    mainLayout.addWidget(previewGroupBox, 0, 0, 1, 2);
    mainLayout.addWidget(imagesGroupBox, 1, 0);
    mainLayout.addWidget(iconSizeGroupBox, 1, 1);
    centralWidget.setLayout(mainLayout);

    setWindowTitle(tr("Icons"));
    otherRadioButton.click();

    setTextOnRadioButtons();

    resize(minimumSizeHint());
  }
Beispiel #2
0
  private void changeSize(boolean checked) {
    if (!checked) return;

    int extent;

    if (otherRadioButton.isChecked()) {
      extent = otherSpinBox.value();
    } else {
      QStyle.PixelMetric metric;

      if (smallRadioButton.isChecked()) {
        metric = QStyle.PixelMetric.PM_SmallIconSize;
      } else if (largeRadioButton.isChecked()) {
        metric = QStyle.PixelMetric.PM_LargeIconSize;
      } else if (toolBarRadioButton.isChecked()) {
        metric = QStyle.PixelMetric.PM_ToolBarIconSize;
      } else if (listViewRadioButton.isChecked()) {
        metric = QStyle.PixelMetric.PM_ListViewIconSize;
      } else if (iconViewRadioButton.isChecked()) {
        metric = QStyle.PixelMetric.PM_IconViewIconSize;
      } else {
        metric = QStyle.PixelMetric.PM_TabBarIconSize;
      }
      extent = QApplication.style().pixelMetric(metric);
    }
    previewArea.setSize(new QSize(extent, extent));
    otherSpinBox.setEnabled(otherRadioButton.isChecked());
  }
Beispiel #3
0
  private void setTextOnRadioButtons() {
    QStyle style = QApplication.style();

    int smallIconSize = style.pixelMetric(QStyle.PixelMetric.PM_SmallIconSize);
    smallRadioButton.setText("Small (" + smallIconSize + " x " + smallIconSize + ")");

    int largeIconSize = style.pixelMetric(QStyle.PixelMetric.PM_LargeIconSize);
    largeRadioButton.setText("Large (" + largeIconSize + " x " + largeIconSize + ")");

    int toolBarIconSize = style.pixelMetric(QStyle.PixelMetric.PM_ToolBarIconSize);
    toolBarRadioButton.setText("Toolbars (" + toolBarIconSize + " x " + toolBarIconSize + ")");

    int listViewIconSize = style.pixelMetric(QStyle.PixelMetric.PM_ListViewIconSize);
    listViewRadioButton.setText("List views (" + listViewIconSize + " x " + listViewIconSize + ")");

    int iconViewIconSize = style.pixelMetric(QStyle.PixelMetric.PM_IconViewIconSize);
    iconViewRadioButton.setText("Icon views (" + iconViewIconSize + " x " + iconViewIconSize + ")");

    int tabBarIconSize = style.pixelMetric(QStyle.PixelMetric.PM_TabBarIconSize);
    tabBarRadioButton.setText("Tab bars (" + tabBarIconSize + " x " + tabBarIconSize + ")");
  }