示例#1
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());
  }
示例#2
0
  private void checkCurrentStyle() {
    for (QAction action : styleActionGroup.actions()) {
      String styleName = action.data().toString();
      QStyle candidate = QStyleFactory.create(styleName);

      if (candidate.objectName().equals(QApplication.style().objectName())) {
        action.trigger();
        return;
      }
    }
  }
示例#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 + ")");
  }