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

📄 booloption.cc

📁 c++的guiQt做的开发
💻 CC
字号:
/** @file BoolOption - class for widget containing one editable setting of type bool @author Martin Petricek*/#include "booloption.h"#include "settings.h"#include <QCheckBox>#include <QResizeEvent>#include <QString>namespace gui {/** Default constructor of BoolOption item @param parent parent Option Editor containing this control @param _key Key in settings for this option @param _defValue Default value if option not found */BoolOption::BoolOption(const QString &_key,QWidget *parent/*=0*/,bool _defValue/*=false*/) : Option (_key,parent) { ed=new QCheckBox(this); connect(ed,SIGNAL(clicked()),this,SLOT(boolChange())); defValue=_defValue;}/** default destructor */BoolOption::~BoolOption() { delete ed;}/** Called when clicked on the checkbox */void BoolOption::boolChange() { changed=true;}/** return size hint of this control @return preferred size of this control*/QSize BoolOption::sizeHint() const { return ed->sizeHint();}/** Called on resizing of this option editing control @param e resize event parameters*/void BoolOption::resizeEvent (QResizeEvent *e) { ed->setFixedSize(e->size());}/** write edited value to settings */void BoolOption::writeValue() { if (!changed) return; bool val=ed->isChecked(); globalSettings->write(key,val?"1":"0");}/** read value from settings for editing */void BoolOption::readValue() { bool val=globalSettings->readBool(key,defValue); ed->setChecked(val);}} // namespace gui

⌨️ 快捷键说明

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