Version: 9.12.0
Style_PrefDlg.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 // File : Style_PrefDlg.h
21 // Author : Vadim SANDLER, Open CASCADE S.A.S (vadim.sandler@opencascade.com)
22 //
23 #ifndef STYLE_PREFDLG_H
24 #define STYLE_PREFDLG_H
25 
26 #include "Style.h"
27 
28 #include <QtxDialog.h>
29 #include <QFrame>
30 #include <QMap>
31 
32 class QCheckBox;
33 class QComboBox;
34 class QLabel;
35 class QListWidget;
36 class QListWidgetItem;
37 class QPushButton;
38 class QRadioButton;
39 class QSlider;
40 class QSpinBox;
41 class QTabWidget;
42 class QtxColorButton;
43 class QtxDoubleSpinBox;
44 class QtxFontEdit;
45 class Style_ResourceMgr;
46 class Style_Model;
47 
49 {
50  Q_OBJECT
51 
52  class PaletteEditor;
53  enum { Current, Default, Global, User };
54  enum { TypeRole = Qt::UserRole + 123, NameRole };
55 
56 public:
57  Style_PrefDlg( QWidget* = 0 );
58  ~Style_PrefDlg();
59 
60  void accept();
61  bool eventFilter( QObject*, QEvent* );
62 
63 private:
64  Style_ResourceMgr* resourceMgr();
65  void fromModel( Style_Model* );
66  void toModel( Style_Model* ) const;
67 
68  QString findUniqueName( const QString&, QListWidgetItem* = 0, bool = false );
69 
70 signals:
71  void styleChanged();
72 
73 private slots:
74  void onApply();
75  void onHelp();
76 
77  void onStyleChanged();
78  void onLinesType();
79  void onChanged();
80  void onItemChanged( QListWidgetItem* );
81  void onEffectChanged( QAbstractButton* );
82 
83 private:
85  QCheckBox* myStyleCheck;
87  QTabWidget* myStylesTab;
88 
97  QCheckBox* myAntiAliasing;
102  QRadioButton* myEffectNone;
103  QRadioButton* myEffectHighlight;
104  QRadioButton* myEffectAutoRaise;
105 
106  QRadioButton* myCurrentEffect;
107 };
108 
110 {
111  Q_OBJECT
112 
113 public:
114  PaletteEditor( QWidget* = 0 );
115  ~PaletteEditor();
116 
117  void addColumn( const QString& );
118  void addItem( int );
119  QList<int> items() const;
120 
121  void setColor( int, QPalette::ColorGroup, const QColor& );
122  void setColor( int, const QColor&, const QColor& = QColor(), const QColor& = QColor() );
123  QColor color( int, QPalette::ColorGroup ) const;
124 
125  bool isAuto() const;
126  void setAuto( bool );
127 
128  void fromColor( const QColor& );
129 
130 private:
131  static QString idToName( int );
132  QWidget* line();
133 
134 private slots:
135  void onQuick();
136  void onAuto();
137 
138 signals:
139  void changed();
140 
141 private:
142  typedef QMap<QPalette::ColorGroup, QtxColorButton*> Btns;
143 
145  QPushButton* myQuickButton;
146  QCheckBox* myAutoCheck;
150 
151  QMap<int, Btns> myButtons;
154 
155  friend class Style_PrefDlg;
156 };
157 
158 #endif // STYLE_PREFDLG_H
#define STYLE_SALOME_EXPORT
Definition: Style.h:33
@ TypeRole
Definition: VTKViewer_MarkerWidget.cxx:34
For more information see QT documentation.
Definition: SUIT_Application.h:42
The QtxColorButton class implements a widget for color preference items editing.
Definition: QtxColorButton.h:36
Generic dialog box class.
Definition: QtxDialog.h:43
virtual void accept()
Accept the dialog box.
Definition: QtxDialog.cxx:1371
Enhanced version of the Qt's double spin box.
Definition: QtxDoubleSpinBox.h:32
The QtxFontEdit class represents a widget for font preference items editing.
Definition: QtxFontEdit.h:36
SALOME style model.
Definition: Style_Model.h:41
SALOME style palette editor widget.
Definition: Style_PrefDlg.h:110
~PaletteEditor()
Destructor.
Definition: Style_PrefDlg.cxx:97
QMap< int, Btns > myButtons
Definition: Style_PrefDlg.h:151
QPushButton * myQuickButton
Definition: Style_PrefDlg.h:145
void onQuick()
Called when "Quick" button is clicked.
Definition: Style_PrefDlg.cxx:452
QFrame * myContainer
Definition: Style_PrefDlg.h:144
static QString idToName(int)
Get title of the item.
Definition: Style_PrefDlg.cxx:358
QLabel * myDisabledLab
Definition: Style_PrefDlg.h:149
void setColor(int, QPalette::ColorGroup, const QColor &)
Set color value to the item.
Definition: Style_PrefDlg.cxx:195
void addColumn(const QString &)
Add new color properties column to the widget.
Definition: Style_PrefDlg.cxx:107
QList< int > items() const
Get list of currently available color items.
Definition: Style_PrefDlg.cxx:182
QLabel * myActiveLab
Definition: Style_PrefDlg.h:147
void fromColor(const QColor &)
Initialize all palette colors from color c.
Definition: Style_PrefDlg.cxx:263
QCheckBox * myAutoCheck
Definition: Style_PrefDlg.h:146
bool isAuto() const
Get 'auto-palette' flag value.
Definition: Style_PrefDlg.cxx:242
QMap< QPalette::ColorGroup, QtxColorButton * > Btns
Definition: Style_PrefDlg.h:142
void onAuto()
Called when "Auto" check box is clicked.
Definition: Style_PrefDlg.cxx:466
int myCurrentColumn
Definition: Style_PrefDlg.h:153
void setAuto(bool)
Set/clear 'auto-palette' flag value.
Definition: Style_PrefDlg.cxx:253
QColor color(int, QPalette::ColorGroup) const
Get color value assigned to the item.
Definition: Style_PrefDlg.cxx:227
PaletteEditor(QWidget *=0)
Constructor.
Definition: Style_PrefDlg.cxx:67
void addItem(int)
Add color item to the widget (to the current column)
Definition: Style_PrefDlg.cxx:150
int myCurrentRow
Definition: Style_PrefDlg.h:152
QWidget * line()
Create horizontal line widget.
Definition: Style_PrefDlg.cxx:441
QLabel * myInactiveLab
Definition: Style_PrefDlg.h:148
SALOME style prefences dialog box class.
Definition: Style_PrefDlg.h:49
QSpinBox * myVerHandleDelta
Definition: Style_PrefDlg.h:99
QSpinBox * mySplitterLength
Definition: Style_PrefDlg.h:100
QSpinBox * myHorHandleDelta
Definition: Style_PrefDlg.h:98
QRadioButton * myEffectAutoRaise
Definition: Style_PrefDlg.h:104
QTabWidget * myStylesTab
Definition: Style_PrefDlg.h:87
QCheckBox * myAntiAliasing
Definition: Style_PrefDlg.h:97
QtxDoubleSpinBox * myFrameRound
Definition: Style_PrefDlg.h:95
QSpinBox * mySliderSize
Definition: Style_PrefDlg.h:101
QCheckBox * myStyleCheck
Definition: Style_PrefDlg.h:85
QtxDoubleSpinBox * myButtonRound
Definition: Style_PrefDlg.h:94
@ Current
Definition: Style_PrefDlg.h:53
QRadioButton * myCurrentEffect
Definition: Style_PrefDlg.h:106
QtxFontEdit * myFontEdit
Definition: Style_PrefDlg.h:90
QtxDoubleSpinBox * mySliderRound
Definition: Style_PrefDlg.h:96
PaletteEditor * myPaletteEditor
Definition: Style_PrefDlg.h:89
QListWidget * myStylesList
Definition: Style_PrefDlg.h:86
Style_ResourceMgr * myResMgr
Definition: Style_PrefDlg.h:84
QtxDoubleSpinBox * myEditRound
Definition: Style_PrefDlg.h:93
QRadioButton * myEffectNone
Definition: Style_PrefDlg.h:102
QComboBox * myLinesCombo
Definition: Style_PrefDlg.h:91
QSlider * myLinesTransparency
Definition: Style_PrefDlg.h:92
QRadioButton * myEffectHighlight
Definition: Style_PrefDlg.h:103
void styleChanged()
SALOME style resources manager.
Definition: Style_ResourceMgr.h:35