⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 optionwindow.h

📁 c++的guiQt做的开发
💻 H
字号:
#ifndef __OPTIONWINDOW_H__#define __OPTIONWINDOW_H__#include <QWidget>#include <QMap>class QLabel;class QTabWidget;class QFrame;class QGridLayout;namespace gui {class Menu;class Option;/** Widget for editing program options<br> Options are arranged to tabs. This is generic class for option window and should be subclassed to create specific window. In constructor, the window should be filled by all necessary tabs and elements It may be useful to override postApply method to run some code after options were saved and flushed to disk. <br> <br> In the subclass constructor, addTab should be used to create a new tab, then use addOption (addOptionInt, addOptionBool, etc ...) calls to fill the tab with options, then use finishTab to "close" the tab. Options are arranged one at a line <br> addText may be used to insert ordinatory explanatory text (spanning one or more lines) <br> addBreak may be used to insert a break in middle of the tab \brief Generic window for showing/editing program settings*/class OptionWindow : public QWidget { Q_OBJECTpublic slots: void apply(); void ok();public: virtual ~OptionWindow();protected: void setLeftCornerText(const QString &text); OptionWindow(const QString &windowTitle,QWidget *parent=0,const QString &widgetName=QString::null); virtual void postApply(); QWidget* addTab(const QString name,bool makeSegments=false); void addOption(QWidget *otab,const QString &caption,Option *opt); void addOption(QWidget *otab,const QString &caption,const QString &key,const QString &defValue=QString::null); void addOptionFont(QWidget *otab,const QString &caption,const QString &key,const QString &defValue=QString::null); void addOptionCombo(QWidget *otab,const QString &caption,const QString &key,const QStringList &values); void addOptionCombo(QWidget *otab,const QString &caption,const QString &key,const QStringList &values,const QStringList &descriptions); void addOptionInt(QWidget *otab,const QString &caption,const QString &key,int defValue=0); void addOptionBool(QWidget *otab,const QString &caption,const QString &key,bool defValue=false); void addOptionFloat(QWidget *otab,const QString &caption,const QString &key); void addWidget(QWidget *otab,QWidget *elem); void addText(QWidget *otab,const QString &text); QWidget* addBreak(QWidget *otab); void finishTab(QWidget *otab); void clear();private: void initGridFrame(QWidget *grid);private: /** List of option names */ QStringList *list; /** Dictionary with option items */ QMap<QString,Option*> *items; /** Dictionary with option labels */ QMap<QString,QLabel*> *labels; /** Main tab widget */ QTabWidget *tab; /** Grid layout for the tab */ QMap<QWidget*,QGridLayout*> gridl; /** Master Grid for the tab */ QMap<QWidget*,QFrame*> masterGrid; /** Number of objects in the tab */ QMap<QWidget*,int> nObjects; /** Identifier of the widget in settings */ QString wName; /** Label on left of Ok/Apply/Cancel combo */ QLabel *leftLabel;};} // namespace gui#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -