本文整理汇总了C++中QRadioButton::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ QRadioButton::setText方法的具体用法?C++ QRadioButton::setText怎么用?C++ QRadioButton::setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRadioButton
的用法示例。
在下文中一共展示了QRadioButton::setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: occupancyPage
//Revise Rates tab
void MainWindow::occupancyPage()
{
QLabel *monthLabel = new QLabel(tr("Month : "));
QLabel *averageOccupancyLabel = new QLabel(tr("Average Occupancy : "));
monthCombo = new QComboBox;
averageOccupancyField = new QLineEdit;
QStringList months;
months <<"January"<<"February"<<"March"<<"April"<<"May"<<"June"<<"July"<<"August"<<"September"<<"October"<<"November"<<"December";
monthCombo->addItems(months);
connect(monthCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(setValue(const int)));
connect(monthCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(showAverageOccupancy()));
monthCombo->setCurrentIndex(0);
averageOccupancyField->setText(QString::number(manager->getAverageOccupancy(0)));
averageOccupancyField->setReadOnly(true);
QLabel *reviseRatesLabel = new QLabel;
reviseRatesLabel->setText(tr("Revise Rates By % : "));
reviseRatesField = new QLineEdit(tr("0"));
QRadioButton *reviseRatesUpRadio = new QRadioButton;
reviseRatesUpRadio->setText(tr("Increment"));
QRadioButton *reviseRatesDownRadio = new QRadioButton;
reviseRatesDownRadio->setText(tr("Decrement"));
reviseRatesGroup = new QButtonGroup;
reviseRatesGroup->addButton(reviseRatesUpRadio,0);
reviseRatesGroup->addButton(reviseRatesDownRadio,1);
reviseRatesUpRadio->setChecked(true);
QPushButton *reviseRatesButton = new QPushButton(tr("Revise Tariff"));
connect(reviseRatesButton,SIGNAL(clicked()),this,SLOT(reviseRates()));
connect(reviseRatesField, SIGNAL(returnPressed()), this, SLOT(reviseRates()));
occupancyWidget = new QWidget;
QHBoxLayout *horizontalLayout1 = new QHBoxLayout;
horizontalLayout1->addWidget(monthLabel);
horizontalLayout1->addWidget(monthCombo);
QHBoxLayout *horizontalLayout2 = new QHBoxLayout;
horizontalLayout2->addWidget(averageOccupancyLabel);
horizontalLayout2->addWidget(averageOccupancyField);
QHBoxLayout *horizontalLayout3 = new QHBoxLayout;
horizontalLayout3->addWidget(reviseRatesLabel);
horizontalLayout3->addWidget(reviseRatesField);
horizontalLayout3->addWidget(reviseRatesUpRadio);
horizontalLayout3->addWidget(reviseRatesDownRadio);
QVBoxLayout *verticalLayout = new QVBoxLayout;
verticalLayout->addLayout(horizontalLayout1);
verticalLayout->addLayout(horizontalLayout2);
verticalLayout->addLayout(horizontalLayout3);
verticalLayout->addWidget(reviseRatesButton);
occupancyWidget->setLayout(verticalLayout);
}
示例2: QLabel
GNumericalExpressionSettingsWidget::GNumericalExpressionSettingsWidget( GNumericalExpression* numericalExpression, QObject* parent /*= NULL*/)
{
m_NumericalExpression = numericalExpression;
QGroupBox* pExpressionSettings = new QGroupBox;
QBoxLayout* pExpressionSettingsLayout = new QVBoxLayout;
QBoxLayout* pExpressionEditLayout = new QHBoxLayout;
pExpressionSettings->setFixedWidth(400);
pExpressionSettings->setTitle("Expression Settings");
pExpressionSettings->setLayout(pExpressionSettingsLayout);
pExpressionEditLayout->insertWidget(0, new QLabel("Expression:"), 0);
pExpressionEditLayout->insertWidget(1, m_NumericalExpression->m_Expression.ProvideNewParamLineEdit(pExpressionSettings), 0);
pExpressionSettingsLayout->insertLayout(0, pExpressionEditLayout);
QGroupBox* pVariableSettings = new QGroupBox;
QGroupBox* pShowVariables = new QGroupBox;
QBoxLayout* pShowVariablesLayout = new QVBoxLayout;
QBoxLayout* pVariableSettingsLayout = new QVBoxLayout;
QRadioButton* pLayoutVariablesVertically = new QRadioButton;
QRadioButton* pLayoutVariablesHorizontally = new QRadioButton;
QRadioButton* pLayoutVariablesGrid = new QRadioButton;
pVariableSettings->setFixedWidth(400);
pVariableSettings->setTitle("Variable Settings");
pVariableSettings->setLayout(pVariableSettingsLayout);
pShowVariables->setTitle("Show Variables");
pShowVariables->setCheckable(true);
pShowVariables->setLayout(pShowVariablesLayout);
pLayoutVariablesHorizontally->setText("Layout: Horizontal");
pShowVariablesLayout->insertWidget(0, pLayoutVariablesHorizontally);
pLayoutVariablesVertically->setText("Layout: Vertical");
pShowVariablesLayout->insertWidget(1, pLayoutVariablesVertically);
pLayoutVariablesGrid->setText("Layout: Grid");
pShowVariablesLayout->insertWidget(2, pLayoutVariablesGrid);
pVariableSettingsLayout->insertWidget(0, pShowVariables);
QPushButton* pAcceptButton = new QPushButton;
QPushButton* pCloseButton = new QPushButton;
QBoxLayout* pButtonLayout = new QHBoxLayout;
pAcceptButton->setText("Accept");
connect(pAcceptButton, SIGNAL(clicked(bool)), this, SLOT(Accept()));
pCloseButton->setText("Close");
connect(pCloseButton, SIGNAL(clicked(bool)), this, SLOT(close()));
pButtonLayout->insertWidget(0, pAcceptButton, 1);
pButtonLayout->insertWidget(1, pCloseButton, 1);
QBoxLayout* pMainLayout = new QVBoxLayout;
pMainLayout->setSizeConstraint(QLayout::SetFixedSize);
setLayout(pMainLayout);
pMainLayout->insertWidget(0, pExpressionSettings, 1);
pMainLayout->insertWidget(1, pVariableSettings, 1);
pMainLayout->insertLayout(2, pButtonLayout, 0);
}
示例3: initialize
void PreferencesDialog::initialize(PreferencesTab initialTab, const persistence::Settings *settings, const QMap<QString, QString> &jamRecorders)
{
Q_UNUSED(initialTab);
this->settings = settings;
this->jamRecorders = jamRecorders;
this->jamRecorderCheckBoxes = QMap<QCheckBox *, QString>();
this->jamDateFormatRadioButtons = QMap<const QRadioButton *, QString>();
for (const auto &jamRecorder : jamRecorders.keys()) {
QCheckBox *myCheckBox = new QCheckBox(this);
myCheckBox->setObjectName(jamRecorder);
myCheckBox->setText(jamRecorders.value(jamRecorder));
ui->layoutRecorders->addWidget(myCheckBox);
jamRecorderCheckBoxes[myCheckBox] = jamRecorder;
}
QDateTime now = QDateTime::currentDateTime();
Qt::DateFormat dateFormat;
QString nowString;
QRadioButton *myRadioButton;
dateFormat = Qt::TextDate;
nowString = "Jam-" + now.toString(dateFormat).replace(QRegExp("[/:]"), "-").replace(QRegExp("[ ]"), "_");
myRadioButton = new QRadioButton(this);
myRadioButton->setObjectName("rbdfTextDate");
myRadioButton->setText(nowString);
myRadioButton->setProperty("buttonGroup", "rbDateFormat");
ui->layoutDateFormats->addWidget(myRadioButton);
jamDateFormatRadioButtons[myRadioButton] = "Qt::TextDate";
dateFormat = Qt::ISODate;
nowString = "Jam-" + now.toString(dateFormat).replace(QRegExp("[/:]"), "-").replace(QRegExp("[ ]"), "_");
myRadioButton = new QRadioButton(this);
myRadioButton->setObjectName("rbdfISODate");
myRadioButton->setText(nowString);
myRadioButton->setProperty("buttonGroup", "rbDateFormat");
ui->layoutDateFormats->addWidget(myRadioButton);
jamDateFormatRadioButtons[myRadioButton] = "Qt::ISODate";
setupSignals();
populateAllTabs();
}
示例4: setFieldConstituentButtons
//------------------------------------------------------------------------------------------------
// To create the group of radiobuttons for field constituent selection.
// This uses information about active constituents fetched from the DLL.
// Need to distinguish field constituent from cell constituent, because for the
// field we have only the dissolved constituents:
// oxygen, glucose, drugA, drugB, metabolites...
//------------------------------------------------------------------------------------------------
void Field::setFieldConstituentButtons(QGroupBox *gbox, QButtonGroup *bg, QVBoxLayout **vbox, QList<QRadioButton *> *rb_list, QString tag)
{
int ivar;
QString name, str, ivar_str;
QRadioButton *rb;
Global::nfieldvars_used = Global::nvars_used - Global::N_EXTRA;
// LOG_QMSG("setFieldConstituentButtons: " + tag + " nfieldvars_used: "
// + QString::number(Global::nfieldvars_used));
if (rb_list->length() != 0) {
LOG_MSG("rb_list not NULL, delete it");
for (ivar=0; ivar<rb_list->length(); ivar++) {
rb = (*rb_list)[ivar];
bg->removeButton(rb);
delete rb;
}
rb_list->clear();
}
if (!*vbox) {
LOG_MSG("vbox = NULL, create it");
*vbox = new QVBoxLayout;
gbox->setLayout(*vbox);
}
name = "rb_field_constituent_"+tag;
// LOG_QMSG(name);
for (ivar=0; ivar<Global::nfieldvars_used; ivar++) {
ivar_str = QString::number(ivar);
str = Global::var_string[ivar+1];
rb = new QRadioButton;
rb->setText(str);
QString objname = name+ivar_str;
rb->setObjectName(objname);
(*vbox)->addWidget(rb);
rb->setEnabled(true);
bg->addButton(rb,ivar);
rb_list->append(rb);
// QRadioButton *chkrb = gbox->findChild<QRadioButton *>(objname);
// if (chkrb) {
// QString chkstr = chkrb->objectName();
// LOG_QMSG(chkstr);
// } else {
// chkrb = (*rb_list)[ivar];
// LOG_QMSG("findChild failed, but: " + chkrb->objectName());
// }
}
(*rb_list)[0]->setChecked(true); // Oxygen
QRect rect = gbox->geometry();
rect.setHeight(25*(Global::nfieldvars_used + 1));
gbox->setGeometry(rect);
gbox->show();
}
示例5: addPlotRadioButton
/** Add a radio button to the plot options
*
* @param text :: text on the radio button
* @param tooltip :: tooltip
* @param bIntegrated :: flag to indicate that the dimension is integrated.
*/
void LinePlotOptions::addPlotRadioButton(const std::string &text,
const std::string &tooltip,
const bool bIntegrated) {
QRadioButton *rad;
rad = new QRadioButton(ui.widgetPlotAxis);
rad->setText(QString::fromStdString(text));
rad->setToolTip(QString::fromStdString(tooltip));
rad->setEnabled(!bIntegrated);
// Insert it one before the horizontal spacer.
QBoxLayout *layout = qobject_cast<QBoxLayout *>(ui.widgetPlotAxis->layout());
layout->insertWidget(layout->count() - 1, rad);
m_radPlots.push_back(rad);
QObject::connect(rad, SIGNAL(toggled(bool)), this, SLOT(radPlot_changed()));
}
示例6: egx_radiobutton_create_
egx_wnd_t egx_radiobutton_create_(int res_id,char *name,egx_uint32_t style,int x,int y,int width,int height,egx_wnd_t parent,egx_wnd_t radiogroup)
{
QRadioButton *button = new QRadioButton((QWidget*)(parent));
button->setText(QString::fromLocal8Bit(name));
if(x == 0 || y == 0){
button->resize(width,height);
}else{
button->setGeometry(x,y,width,height);
}
QButtonGroup *_radiogroup = (QButtonGroup*)radiogroup;
if(_radiogroup){
_radiogroup->addButton(button);
}
return HWND_TO_GUIWND(button);
}
示例7: updateDevicesList
void KSaneDeviceDialog::updateDevicesList()
{
while (!m_btnGroup->buttons().isEmpty()) {
delete m_btnGroup->buttons().takeFirst();
}
const QList<KSaneWidget::DeviceInfo> list = m_findDevThread->devicesList();
if (list.isEmpty()) {
m_btnBox->setTitle(i18n("Sorry. No devices found."));
m_btnBox->layout()->itemAt(0)->widget()->show(); // explanation
m_btnBox->layout()->itemAt(1)->widget()->hide(); // scroll area
enableButton(KDialog::User1, true);
return;
}
delete m_btnLayout;
m_btnLayout = new QVBoxLayout;
m_btnContainer->setLayout(m_btnLayout);
m_btnBox->setTitle(i18n("Found devices:"));
m_btnBox->layout()->itemAt(0)->widget()->hide(); // explanation
m_btnBox->layout()->itemAt(1)->widget()->show(); // scroll area
for (int i=0; i< list.size(); i++) {
QRadioButton *b = new QRadioButton(this);
b->setObjectName(list[i].name);
b->setToolTip(list[i].name);
b->setText(QString("%1 : %2\n%3")
.arg(list[i].vendor)
.arg(list[i].model)
.arg(list[i].name));
m_btnLayout->addWidget(b);
m_btnGroup->addButton(b);
connect(b, SIGNAL(clicked(bool)), this, SLOT(setAvailable(bool)));
if((i==0) || (list[i].name == m_selectedDevice)) {
b->setChecked(true);
setAvailable(true);
}
}
m_btnLayout->addStretch();
if(list.size() == 1) {
button(KDialog::Ok)->animateClick();
}
enableButton(KDialog::User1, true);
}
示例8: setCellConstituentButtons
//------------------------------------------------------------------------------------------------
// To create the group of radiobuttons for cell constituent selection.
// This uses information about active constituents fetched from the DLL.
// Need to distinguish field constituent from cell constituent, because for the cell we are
// interested in CFSE, volume, O2byvol in addition to the dissolved constituents:
// oxygen, glucose, drugA, drugB, metabolites...
//------------------------------------------------------------------------------------------------
void Field::setCellConstituentButtons(QGroupBox *gbox, QButtonGroup *bg, QVBoxLayout **vbox, QList<QRadioButton *> *rb_list, QString tag)
{
int ivar;
QString name, str, ivar_str;
QRadioButton *rb;
LOG_QMSG("setCellConstituentButtons: " + tag);
if (rb_list->length() != 0) {
LOG_MSG("rb_list not NULL, delete it");
for (ivar=0; ivar<rb_list->length(); ivar++) {
rb = (*rb_list)[ivar];
bg->removeButton(rb);
delete rb;
}
rb_list->clear();
}
if (!*vbox) {
LOG_MSG("vbox = NULL, create it");
*vbox = new QVBoxLayout;
gbox->setLayout(*vbox);
}
name = "rb_cell_constituent_"+tag;
LOG_QMSG(name);
sprintf(msg,"rb_list: %p vbox: %p bg: %p nvars_used: %d",rb_list,*vbox,bg,Global::nvars_used);
LOG_MSG(msg);
for (ivar=0; ivar<Global::nvars_used; ivar++) {
ivar_str = QString::number(ivar);
str = Global::var_string[ivar];
rb = new QRadioButton;
rb->setText(str);
rb->setObjectName(name+ivar_str);
(*vbox)->addWidget(rb);
rb->setEnabled(true);
bg->addButton(rb,ivar);
rb_list->append(rb);
// LOG_QMSG(rb->objectName());
}
LOG_MSG("added buttons");
if (tag.contains("FACS")) {
(*rb_list)[0]->setChecked(true); // CFSE
} else {
(*rb_list)[1]->setChecked(true); // Oxygen
}
QRect rect = gbox->geometry();
rect.setHeight(25*Global::nvars_used);
gbox->setGeometry(rect);
gbox->show();
}
示例9: addTypeFormats
void addTypeFormats(const QString &type,
const QStringList &typeFormats, int current)
{
const int row = m_layout->rowCount();
int column = 0;
QButtonGroup *group = new QButtonGroup(this);
m_layout->addWidget(new QLabel(type), row, column++);
for (int i = -1; i != typeFormats.size(); ++i) {
QRadioButton *choice = new QRadioButton(this);
choice->setText(i == -1 ? TypeFormatsDialog::tr("Reset") : typeFormats.at(i));
m_layout->addWidget(choice, row, column++);
if (i == current)
choice->setChecked(true);
group->addButton(choice, i);
}
}
示例10: palette
MainWindow::MainWindow(QWidget *parent):
QMainWindow(parent),
ui(new Ui::MainWindow) {
ui->setupUi(this);
// initializing facade
IWorkInterface* paintingInterface = new CVisualWorkInterface(
ui->DrawPadWidget->geometry().topLeft(),
RSettings::cellHeight(),
RSettings::cellWidth(),
new CPixelMatrixBuilder);
IViewInterface* resultsInterface = new CViewInterface(
ui->HistogramViewWidget->geometry().topLeft(),
ui->HistogramViewWidget->geometry().height(),
ui->HistogramViewWidget->geometry().width(), this, this,
ui->ResultLabel);
IDigitNetwork* network = new CDigitNetwork;
IMessageShower* messager = new CVisualMessageShower;
recognizer = new CRecognizer(paintingInterface, resultsInterface, network,
messager, this, this->palette());
recognizer->init();
recognizer->loadNeuronsFromFile();
// creating radio group
QGridLayout* grid = new QGridLayout;
for(int i = 0; i < 10; ++i) {
QRadioButton *radio = new QRadioButton;
digitRadioButtons[i] = radio;
radio->setText(tr("Digit %1").arg(QString::number(i)));
grid->addWidget(radio, i % 5, i / 5);
}
ui->DigitRadioBox->setLayout(grid);
// initializing palette
QPalette palette(MainWindow::palette());
this->setPalette(palette);
}
示例11: retranslateUi
void retranslateUi(QWidget *MainWindow2)
{
MainWindow2->setWindowTitle(QApplication::translate("MainWindow2", "ActionBox Example", 0, QApplication::UnicodeUTF8));
actionNew->setText(QApplication::translate("MainWindow2", "Create new file", 0, QApplication::UnicodeUTF8));
actionLoad->setText(QApplication::translate("MainWindow2", "Load a file", 0, QApplication::UnicodeUTF8));
actionSave->setText(QApplication::translate("MainWindow2", "Save current file", 0, QApplication::UnicodeUTF8));
actionPrint->setText(QApplication::translate("MainWindow2", "Print file contents", 0, QApplication::UnicodeUTF8));
ActionGroup1->setProperty("headerText", QVariant(QApplication::translate("MainWindow2", "Choose Scheme", 0, QApplication::UnicodeUTF8)));
rbDefaultScheme->setText(QApplication::translate("MainWindow2", "Default", 0, QApplication::UnicodeUTF8));
rbXPBlueScheme->setText(QApplication::translate("MainWindow2", "XP Blue", 0, QApplication::UnicodeUTF8));
rbXPBlue2Scheme->setText(QApplication::translate("MainWindow2", "XP Blue 2", 0, QApplication::UnicodeUTF8));
rbVistaScheme->setText(QApplication::translate("MainWindow2", "Vista", 0, QApplication::UnicodeUTF8));
rbMacScheme->setText(QApplication::translate("MainWindow2", "MacOS", 0, QApplication::UnicodeUTF8));
rbAndroidScheme->setText(QApplication::translate("MainWindow2", "Android", 0, QApplication::UnicodeUTF8));
Q_UNUSED(MainWindow2);
} // retranslateUi
示例12: QDialog
SelectModule::SelectModule (const QString& type, const SelectModule::Dict& types, QWidget * parent)
: QDialog(parent, Qt::WindowTitleHint)
{
setWindowTitle(tr("Select module"));
groupBox = new QGroupBox(this);
groupBox->setTitle(tr("Open %1 as").arg(type));
group = new QButtonGroup(this);
gridLayout = new QGridLayout(this);
gridLayout->setSpacing(6);
gridLayout->setMargin(9);
gridLayout1 = new QGridLayout(groupBox);
gridLayout1->setSpacing(6);
gridLayout1->setMargin(9);
int index = 0;
for (SelectModule::Dict::const_iterator it = types.begin(); it != types.end(); ++it) {
QRadioButton* button = new QRadioButton(groupBox);
QRegExp rx;
QString filter = it.key();
QString module = it.value();
// ignore file types in (...)
rx.setPattern(QLatin1String("\\s+\\([\\w\\*\\s\\.]+\\)$"));
int pos = rx.indexIn(filter);
if (pos != -1) {
filter = filter.left(pos);
}
// ignore Gui suffix in module name
rx.setPattern(QLatin1String("Gui$"));
pos = rx.indexIn(module);
if (pos != -1) {
module = module.left(pos);
}
button->setText(QString::fromAscii("%1 (%2)").arg(filter).arg(module));
button->setObjectName(it.value());
gridLayout1->addWidget(button, index, 0, 1, 1);
group->addButton(button, index);
index++;
}
gridLayout->addWidget(groupBox, 0, 0, 1, 1);
spacerItem = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
gridLayout->addItem(spacerItem, 1, 0, 1, 1);
hboxLayout = new QHBoxLayout();
hboxLayout->setSpacing(6);
hboxLayout->setMargin(0);
spacerItem1 = new QSpacerItem(131, 31, QSizePolicy::Expanding, QSizePolicy::Minimum);
hboxLayout->addItem(spacerItem1);
okButton = new QPushButton(this);
okButton->setObjectName(QString::fromUtf8("okButton"));
okButton->setText(tr("Select"));
okButton->setEnabled(false);
hboxLayout->addWidget(okButton);
gridLayout->addLayout(hboxLayout, 2, 0, 1, 1);
// connections
connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(group, SIGNAL(buttonClicked(int)), this, SLOT(onButtonClicked()));
}
示例13: QWidget
XFormWidget::XFormWidget(QWidget *parent)
: QWidget(parent), textEditor(new QLineEdit)
{
setWindowTitle(tr("Affine Transformations"));
view = new XFormView(this);
view->setMinimumSize(200, 200);
QGroupBox *mainGroup = new QGroupBox(this);
mainGroup->setFixedWidth(180);
mainGroup->setTitle(tr("Affine Transformations"));
QGroupBox *rotateGroup = new QGroupBox(mainGroup);
rotateGroup->setTitle(tr("Rotate"));
QSlider *rotateSlider = new QSlider(Qt::Horizontal, rotateGroup);
rotateSlider->setRange(0, 3600);
rotateSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
QGroupBox *scaleGroup = new QGroupBox(mainGroup);
scaleGroup->setTitle(tr("Scale"));
QSlider *scaleSlider = new QSlider(Qt::Horizontal, scaleGroup);
scaleSlider->setRange(1, 4000);
scaleSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
QGroupBox *shearGroup = new QGroupBox(mainGroup);
shearGroup->setTitle(tr("Shear"));
QSlider *shearSlider = new QSlider(Qt::Horizontal, shearGroup);
shearSlider->setRange(-990, 990);
shearSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
QGroupBox *typeGroup = new QGroupBox(mainGroup);
typeGroup->setTitle(tr("Type"));
QRadioButton *vectorType = new QRadioButton(typeGroup);
QRadioButton *pixmapType = new QRadioButton(typeGroup);
QRadioButton *textType= new QRadioButton(typeGroup);
vectorType->setText(tr("Vector Image"));
pixmapType->setText(tr("Pixmap"));
textType->setText(tr("Text"));
QPushButton *resetButton = new QPushButton(mainGroup);
resetButton->setText(tr("Reset Transform"));
QPushButton *animateButton = new QPushButton(mainGroup);
animateButton->setText(tr("Animate"));
animateButton->setCheckable(true);
QPushButton *showSourceButton = new QPushButton(mainGroup);
showSourceButton->setText(tr("Show Source"));
#ifdef QT_OPENGL_SUPPORT
QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
enableOpenGLButton->setText(tr("Use OpenGL"));
enableOpenGLButton->setCheckable(true);
enableOpenGLButton->setChecked(view->usesOpenGL());
if (!QGLFormat::hasOpenGL())
enableOpenGLButton->hide();
#endif
QPushButton *whatsThisButton = new QPushButton(mainGroup);
whatsThisButton->setText(tr("What's This?"));
whatsThisButton->setCheckable(true);
QHBoxLayout *viewLayout = new QHBoxLayout(this);
viewLayout->addWidget(view);
viewLayout->addWidget(mainGroup);
QVBoxLayout *rotateGroupLayout = new QVBoxLayout(rotateGroup);
rotateGroupLayout->addWidget(rotateSlider);
QVBoxLayout *scaleGroupLayout = new QVBoxLayout(scaleGroup);
scaleGroupLayout->addWidget(scaleSlider);
QVBoxLayout *shearGroupLayout = new QVBoxLayout(shearGroup);
shearGroupLayout->addWidget(shearSlider);
QVBoxLayout *typeGroupLayout = new QVBoxLayout(typeGroup);
typeGroupLayout->addWidget(vectorType);
typeGroupLayout->addWidget(pixmapType);
typeGroupLayout->addWidget(textType);
typeGroupLayout->addSpacing(4);
typeGroupLayout->addWidget(textEditor);
QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup);
mainGroupLayout->addWidget(rotateGroup);
mainGroupLayout->addWidget(scaleGroup);
mainGroupLayout->addWidget(shearGroup);
mainGroupLayout->addWidget(typeGroup);
mainGroupLayout->addStretch(1);
mainGroupLayout->addWidget(resetButton);
mainGroupLayout->addWidget(animateButton);
mainGroupLayout->addWidget(showSourceButton);
#ifdef QT_OPENGL_SUPPORT
mainGroupLayout->addWidget(enableOpenGLButton);
#endif
mainGroupLayout->addWidget(whatsThisButton);
connect(rotateSlider, SIGNAL(valueChanged(int)), view, SLOT(changeRotation(int)));
connect(shearSlider, SIGNAL(valueChanged(int)), view, SLOT(changeShear(int)));
connect(scaleSlider, SIGNAL(valueChanged(int)), view, SLOT(changeScale(int)));
connect(vectorType, SIGNAL(clicked()), view, SLOT(setVectorType()));
connect(pixmapType, SIGNAL(clicked()), view, SLOT(setPixmapType()));
//.........这里部分代码省略.........
示例14: if
static QList<QWidget*> getFormWidgets(QList<FormField> formFields, const QObject *receiver)
{
QList<QWidget*> formWidgets;
for (int i = 0; i < formFields.size(); ++i)
{
Poppler::FormField *formField = formFields.at(i).field;
if (formField->type() == Poppler::FormField::FormText)
{
Poppler::FormFieldText *formFieldText = static_cast<Poppler::FormFieldText*>(formField);
switch (formFieldText->textType())
{
case Poppler::FormFieldText::FileSelect:
{
// TODO replace this by a file selection widget
QLineEdit *lineEdit = new QLineEdit;
lineEdit->setText(formFieldText->text());
lineEdit->setObjectName(QLatin1String("PageItem::formField") + QString::number(i));
QObject::connect(lineEdit, SIGNAL(textEdited(QString)), receiver, SLOT(slotSetFormData(QString)));
formWidgets << lineEdit;
}
break;
case Poppler::FormFieldText::Multiline:
{
QTextEdit *textEdit = new QTextEdit;
textEdit->setText(formFieldText->text());
textEdit->setObjectName(QLatin1String("PageItem::formField") + QString::number(i));
QObject::connect(textEdit, SIGNAL(textChanged()), receiver, SLOT(slotSetFormData()));
formWidgets << textEdit;
}
break;
case Poppler::FormFieldText::Normal:
default:
{
QLineEdit *lineEdit = new QLineEdit;
lineEdit->setText(formFieldText->text());
lineEdit->setObjectName(QLatin1String("PageItem::formField") + QString::number(i));
QObject::connect(lineEdit, SIGNAL(textEdited(QString)), receiver, SLOT(slotSetFormData(QString)));
formWidgets << lineEdit;
}
break;
}
}
else if (formField->type() == Poppler::FormField::FormButton)
{
Poppler::FormFieldButton *formFieldButton = static_cast<Poppler::FormFieldButton*>(formField);
switch (formFieldButton->buttonType())
{
case Poppler::FormFieldButton::CheckBox:
{
QCheckBox *checkBox = new QCheckBox;
// checkBox->setText(formFieldButton->caption());
checkBox->setChecked(formFieldButton->state());
checkBox->setObjectName(QLatin1String("PageItem::formField") + QString::number(i));
QObject::connect(checkBox, SIGNAL(toggled(bool)), receiver, SLOT(slotSetFormData(bool)));
formWidgets << checkBox;
}
break;
case Poppler::FormFieldButton::Radio:
{
QRadioButton *radioButton = new QRadioButton;
radioButton->setText(formFieldButton->caption());
radioButton->setChecked(formFieldButton->state());
radioButton->setObjectName(QLatin1String("PageItem::formField") + QString::number(i));
QObject::connect(radioButton, SIGNAL(toggled(bool)), receiver, SLOT(slotSetFormData(bool)));
formWidgets << radioButton;
}
break;
case Poppler::FormFieldButton::Push:
default:
{
QPushButton *pushButton = new QPushButton;
pushButton->setText(formFieldButton->caption());
pushButton->setChecked(formFieldButton->state());
pushButton->setObjectName(QLatin1String("PageItem::formField") + QString::number(i));
QObject::connect(pushButton, SIGNAL(toggled(bool)), receiver, SLOT(slotSetFormData(bool)));
formWidgets << pushButton;
}
break;
}
}
else if (formField->type() == Poppler::FormField::FormChoice)
{
Poppler::FormFieldChoice *formFieldChoice = static_cast<Poppler::FormFieldChoice*>(formField);
switch (formFieldChoice->choiceType())
{
case Poppler::FormFieldChoice::ComboBox:
{
QComboBox *comboBox = new QComboBox;
comboBox->addItems(formFieldChoice->choices());
comboBox->setEditable(formFieldChoice->isEditable());
comboBox->setCurrentIndex(formFieldChoice->currentChoices().at(0));
comboBox->setObjectName(QLatin1String("PageItem::formField") + QString::number(i));
QObject::connect(comboBox, SIGNAL(currentIndexChanged(int)), receiver, SLOT(slotSetFormData(int)));
formWidgets << comboBox;
}
break;
case Poppler::FormFieldChoice::ListBox:
default:
{
//.........这里部分代码省略.........
示例15: grBtoY
scannerwindow::scannerwindow(QList<int> parameters, QMainWindow *parent, bool load, QTextStream* stream):
QObject(parent)
{
this->parameters=parameters;
widget = new QWidget();
widget->setAttribute(Qt::WA_DeleteOnClose);
graph = new Q3DSurface();
container = QWidget::createWindowContainer(graph, widget);
container->setAttribute(Qt::WA_AcceptTouchEvents);
widget->setGeometry(
QStyle::alignedRect(
Qt::LeftToRight,
Qt::AlignTop,
widget->size(),
qApp->desktop()->availableGeometry()
)
);
bitmapForward=new QCustomPlot(widget);
bitmapBackward=new QCustomPlot(widget);
bitmapCombined=new QCustomPlot(widget);
bitmapForward->setContextMenuPolicy(Qt::CustomContextMenu);
bitmapBackward->setContextMenuPolicy(Qt::CustomContextMenu);
bitmapCombined->setContextMenuPolicy(Qt::CustomContextMenu);
bitmapBackward->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
bitmapForward->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
bitmapCombined->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
initializeBitmapForward(bitmapForward);
initializeBitmapBackward(bitmapBackward);
initializeBitmapCombined(bitmapCombined);
if (!graph->hasContext()) {
QMessageBox msgBox;
msgBox.setText("Couldn't initialize the OpenGL context.");
msgBox.exec();
}
QSize screenSize = graph->screen()->size();
container->setMinimumSize(QSize(screenSize.width() / 3, screenSize.height()/4));
container->setMaximumSize(screenSize);
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
container->setFocusPolicy(Qt::StrongFocus);
bitmapBackward->setMinimumSize(screenSize.width()/4, screenSize.height()/4);
bitmapForward->setMinimumSize(screenSize.width()/4, screenSize.height()/4);
bitmapCombined->setMinimumSize(screenSize.width()/4, screenSize.height()/4);
QHBoxLayout *hLayout = new QHBoxLayout(widget);
QVBoxLayout *vLayout = new QVBoxLayout();
QSplitter *hSplitterMain = new QSplitter();
QSplitter *vSplitterRight = new QSplitter();
hLayout->setSizeConstraint(QBoxLayout::SizeConstraint::SetMinimumSize);
vSplitterRight->addWidget(bitmapForward);
vSplitterRight->addWidget(bitmapBackward);
vSplitterRight->addWidget(bitmapCombined);
vSplitterRight->setOrientation(Qt::Orientation::Vertical);
vSplitterRight->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
hSplitterMain->setOrientation(Qt::Orientation::Horizontal);
hSplitterMain->addWidget(container);
hSplitterMain->addWidget(vSplitterRight);
hSplitterMain->setStyleSheet("QSplitter::handle {background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,stop:0 rgba(255, 255, 255, 0),stop:0.407273 rgba(200, 200, 200, 255),stop:0.4825 rgba(101, 104, 113, 235), stop:0.6 rgba(255, 255, 255, 0));}");
vSplitterRight->setStyleSheet("QSplitter::handle {background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,stop:0 rgba(255, 255, 255, 0),stop:0.407273 rgba(200, 200, 200, 255),stop:0.4825 rgba(101, 104, 113, 235), stop:0.6 rgba(255, 255, 255, 0));}");
hLayout->addWidget(hSplitterMain);
hLayout->addLayout(vLayout);
vLayout->setAlignment(Qt::AlignTop);
widget->setWindowTitle(QStringLiteral("AFM Scan"));
QGroupBox *modelGroupBox = new QGroupBox(QStringLiteral("Scan"));
if(!load){
AFM_Scan_3D_RB = new QPushButton(widget);
AFM_Scan_3D_RB->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
AFM_Scan_3D_RB->setText(QStringLiteral("Start Scan"));
AFM_Scan_3D_RB->setCheckable(true);
AFM_Scan_3D_RB->setChecked(false);
}
SaveSurface = new QPushButton(widget);
SaveSurface->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
SaveSurface->setText(QStringLiteral("Save Data"));
BitmapView = new QPushButton(widget);
BitmapView->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
//.........这里部分代码省略.........