本文整理汇总了C++中QActionGroup::setDisabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QActionGroup::setDisabled方法的具体用法?C++ QActionGroup::setDisabled怎么用?C++ QActionGroup::setDisabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QActionGroup
的用法示例。
在下文中一共展示了QActionGroup::setDisabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
createStatusBar();
// Recent files
for (int i = 0; i < MaxRecentFiles; ++i)
{
recentFileActions[i] = new QAction(this);
recentFileActions[i]->setVisible(false);
connect(recentFileActions[i], SIGNAL(triggered()), this, SLOT(openRecentFile()));
ui->menuFile->insertAction(ui->actionExit, recentFileActions[i]);
}
recentFilesSeparator = ui->menuFile->insertSeparator(ui->actionExit);
printer = new QPrinter;
printer->setFullPage(true);
printer->setPaperSize(QPrinter::Letter);
printer->setPageMargins(.5, .5, .5, .5, QPrinter::Inch);
report = new Report(printer, this);
view = new ReportView(report, this);
preview = new QPrintPreviewWidget(printer, this);
setCentralWidget(preview);
preview->fitToWidth();
QFontComboBox* fontComboBox = new QFontComboBox;
fontComboBox->setFontFilters(QFontComboBox::MonospacedFonts | QFontComboBox::ScalableFonts);
fontComboBox->setCurrentFont(report->font().family());
ui->fontToolBar->insertWidget(ui->actionBold, fontComboBox);
connect(fontComboBox, SIGNAL(currentFontChanged(QFont)), report, SLOT(setFont(QFont)));
pageNumberComboBox = new QComboBox;
ui->viewToolBar->insertWidget(ui->actionNextPage, pageNumberComboBox);
connect(pageNumberComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentPageChanged(int)));
const qreal zoomFactors[] = { 12.5, 25, 50, 100, 125, 150, 200, 400, 800 };
zoomComboBox = new QComboBox;
for (unsigned int i = 0; i < sizeof(zoomFactors) / sizeof(*zoomFactors); ++i)
{
zoomComboBox->addItem(QString("%1%").arg(zoomFactors[i]));
}
zoomComboBox->setCurrentIndex(-1);
ui->viewToolBar->insertWidget(ui->actionZoomOut, zoomComboBox);
connect(zoomComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(zoomChanged(QString)));
QActionGroup* orientationGroup = new QActionGroup(this);
orientationGroup->addAction(ui->actionPortrait);
orientationGroup->addAction(ui->actionLandscape);
orientationChanged(report->orientation());
QActionGroup* heightGroup = new QActionGroup(this);
heightGroup->addAction(ui->action6LPI);
heightGroup->addAction(ui->action8LPI);
heightGroup->addAction(ui->action9LPI);
heightGroup->setDisabled(ui->actionStretchFont->isEnabled());
connect(ui->actionStretchFont, SIGNAL(toggled(bool)), heightGroup, SLOT(setDisabled(bool)));
QActionGroup* widthGroup = new QActionGroup(this);
widthGroup->addAction(ui->actionDefaultWidth);
widthGroup->addAction(ui->action10CPI);
widthGroup->addAction(ui->action12CPI);
widthGroup->addAction(ui->action17CPI);
widthGroup->setDisabled(ui->actionStretchFont->isEnabled());
connect(ui->actionStretchFont, SIGNAL(toggled(bool)), widthGroup, SLOT(setDisabled(bool)));
QActionGroup* pageGroup = new QActionGroup(this);
pageGroup->addAction(ui->actionSinglePage);
pageGroup->addAction(ui->actionFacingPages);
pageGroup->addAction(ui->actionAllPages);
ui->actionSinglePage->setChecked(preview->viewMode() == QPrintPreviewWidget::SinglePageView);
ui->actionFacingPages->setChecked(preview->viewMode() == QPrintPreviewWidget::FacingPagesView);
ui->actionAllPages->setChecked(preview->viewMode() == QPrintPreviewWidget::AllPagesView);
connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()));
connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
connect(ui->actionOpenURL, SIGNAL(triggered()), this, SLOT(openUrl()));
connect(ui->actionReload, SIGNAL(triggered()), this, SLOT(reload()));
connect(ui->actionSaveAsPDF, SIGNAL(triggered()), this, SLOT(saveAsPdf()));
connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print()));
connect(ui->actionPageSetup, SIGNAL(triggered()), this, SLOT(pageSetup()));
connect(ui->actionEmail, SIGNAL(triggered()), this, SLOT(email()));
connect(ui->actionCopy, SIGNAL(triggered()), this, SLOT(copy()));
connect(ui->actionStretchFont, SIGNAL(toggled(bool)), report, SLOT(setStretchFont(bool)));
connect(report, SIGNAL(stretchFontChanged(bool)), ui->actionStretchFont, SLOT(setChecked(bool)));
connect(ui->actionBold, SIGNAL(toggled(bool)), report, SLOT(setBold(bool)));
connect(ui->actionStripes, SIGNAL(toggled(bool)), report, SLOT(setStripes(bool)));
connect(ui->actionStripeColor, SIGNAL(triggered()), this, SLOT(stripeColor()));
connect(ui->actionColor, SIGNAL(triggered()), this, SLOT(fontColor()));
connect(ui->action6LPI, SIGNAL(triggered()), this, SLOT(height6Lpi()));
connect(ui->action8LPI, SIGNAL(triggered()), this, SLOT(height8Lpi()));
connect(ui->action9LPI, SIGNAL(triggered()), this, SLOT(height9Lpi()));
connect(ui->actionDefaultWidth, SIGNAL(toggled(bool)), this, SLOT(widthDefault()));
connect(ui->action10CPI, SIGNAL(triggered()), this, SLOT(width10Cpi()));
connect(ui->action12CPI, SIGNAL(triggered()), this, SLOT(width12Cpi()));
connect(ui->action17CPI, SIGNAL(triggered()), this, SLOT(width17Cpi()));
//.........这里部分代码省略.........