Exemplo n.º 1
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;
      }
    }
  }
Exemplo n.º 2
0
  private void changeStyle(boolean checked) {
    if (!checked) return;

    QAction action = (QAction) QSignalEmitter.signalSender();
    QStyle style = QStyleFactory.create((String) action.data());

    if (style != null) {
      QApplication.setStyle(style);
      QApplication.setPalette(style.standardPalette());
    }

    setTextOnRadioButtons();

    changeSize(true);
  }
Exemplo n.º 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 + ")");
  }