本文整理汇总了C++中setWindowModality函数的典型用法代码示例。如果您正苦于以下问题:C++ setWindowModality函数的具体用法?C++ setWindowModality怎么用?C++ setWindowModality使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setWindowModality函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDialog
PackAddonSummaryFilesWidget::PackAddonSummaryFilesWidget(PackAddonDialog * pParent)
: QDialog(pParent)
{
setObjectName("addon_package_summary_file_dialog");
setWindowTitle(__tr2qs_ctx("File Summary","addon"));
setWindowModality(Qt::WindowModal);
setModal(true);
QVBoxLayout * pLayout = new QVBoxLayout(this);
QLabel * pLabel = new QLabel(this);
pLabel->setText(__tr2qs_ctx("Here are the files found in the directories you provided.\nIf the files listed below are correct, hit the \"Finish\" button to complete the packaging operation.","addon"));
pLayout->addWidget(pLabel);
m_pFiles = new QTextEdit(this);
m_pFiles->setReadOnly(true);
pLayout->addWidget(m_pFiles);
KviTalHBox * pBox = new KviTalHBox(this);
QPushButton * pCancel = new QPushButton(pBox);
pCancel->setText(__tr2qs_ctx("Cancel","addon"));
connect(pCancel,SIGNAL(clicked()),this,SLOT(reject()));
QPushButton * pAccept = new QPushButton(pBox);
pAccept->setText(__tr2qs_ctx("Finish","addon"));
connect(pAccept,SIGNAL(clicked()),this,SLOT(accept()));
pLayout->addWidget(pBox);
}
示例2: ui
NewPasswordDialog::NewPasswordDialog(GUtil::Qt::Settings *settings,
const QString &filename,
QWidget *par)
:QDialog(par),
ui(new Ui::NewPassword),
m_settings(settings)
{
ui->setupUi(this);
setWindowModality(Qt::WindowModal);
setWindowTitle(QString(tr("New Key Info for %1")).arg(filename));
// We want to intercept when the user presses 'return'
ui->lineEdit->installEventFilter(this);
ui->lineEdit_2->installEventFilter(this);
ui->lineEdit->setFocus();
if(settings->Contains(SETTING_LAST_CB_INDEX)){
int old_index = ui->comboBox->currentIndex();
ui->comboBox->setCurrentIndex(settings->Value(SETTING_LAST_CB_INDEX).toInt());
if(old_index == ui->comboBox->currentIndex())
_combobox_indexchanged(old_index);
}
else
_combobox_indexchanged(ui->comboBox->currentIndex());
}
示例3: mArea
VBoxScreenshotViewer::VBoxScreenshotViewer (QWidget *aParent, const QPixmap &aScreenshot,
const QString &aSnapshotName, const QString &aMachineName)
: QIWithRetranslateUI2 <QWidget> (aParent, Qt::Tool)
, mArea (new QScrollArea (this))
, mPicture (new QLabel)
, mScreenshot (aScreenshot)
, mSnapshotName (aSnapshotName)
, mMachineName (aMachineName)
, mZoomMode (true)
{
setWindowModality (Qt::ApplicationModal);
setCursor (Qt::PointingHandCursor);
QVBoxLayout *layout = new QVBoxLayout (this);
layout->setMargin (0);
mArea->setWidget (mPicture);
mArea->setWidgetResizable (true);
layout->addWidget (mArea);
double aspectRatio = (double) aScreenshot.height() / aScreenshot.width();
QSize maxSize = aScreenshot.size() + QSize (mArea->frameWidth() * 2, mArea->frameWidth() * 2);
QSize initSize = QSize (640, (int)(640 * aspectRatio)).boundedTo (maxSize);
setMaximumSize (maxSize);
QRect geo (QPoint (0, 0), initSize);
geo.moveCenter (parentWidget()->geometry().center());
VBoxGlobal::setTopLevelGeometry(this, geo);
retranslateUi();
}
示例4: setWindowModality
void Frame::set_window_modality()
{
if (frame_type == "Dialog") // modal for Dialog frames
{
setWindowModality(Qt::WindowModal);
}
}
示例5: QDialog
EditorPanel::EditorPanel(QPixmap pix, QWidget *parent) :
QDialog(parent,Qt::CustomizeWindowHint),
ui(new Ui::EditorPanelUI)
{
ui->setupUi(this);
setFixedSize(size());
currentPix = pix;
setWindowModality(Qt::ApplicationModal);
QObject::connect(ui->btn_OK, SIGNAL(clicked()), this, SLOT(edit()));
QObject::connect(ui->pushCancel, SIGNAL(clicked()), this, SLOT(reject()));
ui->spinBoxHeight->setValue(currentPix.height());
ui->spinBoxWigth->setValue(currentPix.width());
pixSize = pix.size();
connect(ui->spinBoxHeight,static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=](int h){
if(ui->btn_lock->isChecked()){
ui->spinBoxWigth->blockSignals(true);
QSize newSize(ui->spinBoxHeight->value(),h);
QSize diffSize = (QSize(pixSize.width(),h) - pixSize);
pixSize.scale(newSize, diffSize.isValid() ? Qt::KeepAspectRatioByExpanding : Qt::KeepAspectRatio);
ui->spinBoxWigth->setValue(pixSize.width());
ui->spinBoxWigth->blockSignals(false);
}
});
connect(ui->spinBoxWigth,static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=](int w){
if(ui->btn_lock->isChecked()){
ui->spinBoxHeight->blockSignals(true);
QSize newSize(w,ui->spinBoxHeight->value());
QSize diffSize = (QSize(w,pixSize.height()) - pixSize);
pixSize.scale(newSize, diffSize.isValid() ? Qt::KeepAspectRatioByExpanding : Qt::KeepAspectRatio);
ui->spinBoxHeight->setValue(pixSize.height());
ui->spinBoxWigth->blockSignals(false);
}
});
}
示例6: setWindowFlags
TicketPopup::TicketPopup(QWidget *parent, QString text, QPixmap pixmap, int timeToClose)
{
setWindowFlags(Qt::Dialog|Qt::FramelessWindowHint);
setWindowModality(Qt::ApplicationModal);
setObjectName("main");
gridLayout = new QGridLayout(this);
imagelabel = new QLabel(this);
imagelabel->setPixmap(pixmap);
imagelabel->setAlignment(Qt::AlignCenter);
gridLayout->addWidget(imagelabel, 0, 0);
editText = new QTextEdit(this);
editText->setHtml(text);
editText->setReadOnly(true);
gridLayout->addWidget(editText, 1, 0);
gridLayout->setMargin(17);
timer = new QTimer(this);
timer->setInterval(timeToClose);
connect(timer, SIGNAL(timeout()), this, SLOT(closeIt()));
QString path = KStandardDirs::locate("appdata", "images/");
QString filen = path + "/imgPrint.png";
QPixmap pix(filen);
setMask(pix.mask());
QString st;
st = QString("main { background-image: url(%1);}").arg(filen);
setStyleSheet(st);
}
示例7: QDialog
KrCalcSpaceDialog::KrCalcSpaceDialog(QWidget *parent, KrPanel * panel, const QStringList & items, bool autoclose) :
QDialog(parent), m_autoClose(autoclose), m_canceled(false),
m_timerCounter(0), m_items(items), m_view(panel->view)
{
setWindowTitle(i18n("Calculate Occupied Space"));
setWindowModality(Qt::WindowModal);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
m_thread = new CalcThread(panel->virtualPath(), items);
m_pollTimer = new QTimer(this);
m_label = new QLabel("", this);
mainLayout->addWidget(m_label);
showResult(); // fill m_label with something useful
mainLayout->addStretch(10);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
mainLayout->addWidget(buttonBox);
okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
// the dialog: The Ok button is hidden until it is needed
okButton->setVisible(false);
cancelButton = buttonBox->button(QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), SLOT(slotCancel()));
}
示例8: ShadowWidget
SkinWidget::SkinWidget(QWidget *parent)
: ShadowWidget(parent)
, PIC_PATH(qApp->applicationDirPath() + "/../sources/img/skin/")
, pImpl(new SkinWidget_Impl())
{
setAttribute(Qt::WA_QuitOnClose, false);
setWindowModality(Qt::ApplicationModal);
QHBoxLayout *up_title_layout = new QHBoxLayout;
set_no_margin(up_title_layout);
pImpl->btn_close->setPicName(":/sysbutton/close");
connect(pImpl->btn_close, SIGNAL(clicked()), this, SLOT(hide()));
up_title_layout->addWidget(pImpl->btn_close, 0, Qt::AlignTop);
up_title_layout->addStretch();
QVBoxLayout *main_layout = new QVBoxLayout(this);
pImpl->view->setWidgetResizable(true);
pImpl->view->setContentsMargins(0, 0, 0, 0);
QWidget *viewWidgetContents = new QWidget(pImpl->view);
pImpl->scroll_layout->setContentsMargins(0, 0, 0, 0);
pImpl->scroll_layout->setSpacing(2);
viewWidgetContents->setLayout(pImpl->scroll_layout);
pImpl->view->setWidget(viewWidgetContents);
main_layout->addLayout(up_title_layout);
main_layout->addWidget(pImpl->view);
main_layout->setSpacing(0);
main_layout->setContentsMargins(5, 5, 5, 5);
QPalette text_palette = palette();
text_palette.setColor(QPalette::Background, QColor(255, 255, 255, 50));
setPalette(text_palette);
setMinimumSize(800, 430);
find_file(PIC_PATH);
}
示例9: QDialog
MDialog::MDialog(QWidget* parent): QDialog(parent) {
onyx::screen::instance().enableUpdate ( true );
onyx::screen::instance().setDefaultWaveform(onyx::screen::ScreenProxy::GC);
setWindowModality(Qt::ApplicationModal);
setWindowFlags(Qt::FramelessWindowHint);
QGridLayout *layout = new QGridLayout(this);
QButtonGroup *group = new QButtonGroup(this);
for ( int i = 1; i < 10; ++i ) {
MToolButton *key = new MToolButton(this);
key->setText(QString::number(i));
//key->resize(40,40);
key->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
//setFocusPolicy(Qt::NoFocus);
list.append (key);
group->addButton ( key, i );
layout->addWidget ( key, (i - 1) / 3, (i - 1) % 3 );
connect(key, SIGNAL(clicked(bool)),this, SLOT(accept()));
}
group->button ( qBound ( 1, QSettings().value ( "Key", 1 ).toInt(), 10 ) )->click();
connect ( group, SIGNAL (buttonClicked(int)), this, SLOT ( setActiveKey ( int ) ) ); ///<will change keypad
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
//TODO set current_button_ to selected one
current_button_ = 0;
list.at(0)->setFocus();
setLayout(layout);
}
示例10: setSizeAndPosition
//-------------------------------------------------------------------------
IoProgressDialog::IoProgressDialog( QWidget *parent /*= 0*/ )
:QDialog(parent),_parent(parent)
{
ui.setupUi(this);
setSizeAndPosition( _parent);
Qt::WindowFlags flags;
ui.label->setOpenExternalLinks( true );
ui.msgLabel->setOpenExternalLinks( true );
#ifdef Q_OS_OSX
flags = Qt::Sheet;
#else
flags = Qt::SplashScreen;
ui.progressBar->setFormat("%v/%m");
ui.progressBar->setTextVisible(true);
#endif
this->setWindowOpacity(0.8);
flags ^= Qt::NoDropShadowWindowHint;
setWindowFlags(flags);
setWindowModality(Qt::WindowModal);
setModal(true);
this->setWindowIcon(QIcon(":/images/res/dcpm_256x256x32.png"));
_s = size();
setIoHealth( 0 );
}
示例11: BoxContextMenu
ParentBoxContextMenu::ParentBoxContextMenu(ParentBox *box) :
BoxContextMenu((BasicBox*)box)
{
_box = box;
setWindowModality(Qt::ApplicationModal);
}
示例12: tDialog
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
tLockedDialog::tLockedDialog( QWidget* pParent )
: tDialog( tDialog::Partial, pParent, DarkenOff )
{
setWindowTitle( tr( "Locked" ) );
setWindowModality( Qt::WindowModal );
m_pTimer = new QTimer( this );
m_pTimer->setInterval( 2000 );
m_pTimer->setSingleShot( true );
Connect( m_pTimer, SIGNAL( timeout() ), this, SLOT( accept() ) );
m_pTimer->start();
QHBoxLayout* pLayout = new QHBoxLayout( this );
QLabel* pIcon = new QLabel();
pIcon->setPixmap( tSystemSettings::Instance()->NightMode() ?
tPath::ResourceFile( "medusa/icons/keylock_night.png" ) :
tPath::ResourceFile( "medusa/icons/keylock_day.png" ) );
QLabel* pLabel = new QLabel( tr( "Autopilot is locked" ) );
pLayout->addWidget( pIcon );
pLayout->addWidget( pLabel );
setLayout( pLayout );
}
示例13: QWidget
AdvancedSettingsWnd::AdvancedSettingsWnd(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
#ifdef Q_WS_MAEMO_5
setWindowFlags(windowFlags() | Qt::Window);
// setAttribute(Qt::WA_Maemo5StackedWindow, true);
// workaround for stacked window not working correclty:
setAttribute(Qt::WA_Maemo5PortraitOrientation, true);
setWindowModality(Qt::WindowModal);
#else
setParent(NULL);
#endif
if (true) // TODO zzzz; auto-detect orientation
{
// switch to portrait mode
QHBoxLayout* buttonBoxLayout = new QHBoxLayout();
ui.buttonBoxSpacer->changeSize(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
ui.buttonBoxLayout->removeItem(ui.buttonBoxSpacer);
_delete(ui.buttonBoxSpacer);
ui.verticalLayout->removeWidget(ui.buttonBox);
buttonBoxLayout->addWidget(ui.buttonBox);
ui.gridLayout->removeItem(ui.buttonBoxLayout);
_delete(ui.buttonBoxLayout);
ui.gridLayout->addItem(buttonBoxLayout, 1, 0, 1, 1);
}
m_result = QDialog::Rejected;
}
示例14: QDialog
CLayoutWizard::CLayoutWizard(QWidget *parent) :
QDialog(parent,Qt::Sheet),
ui(new Ui::CLayoutWizard)
{
ui->setupUi(this);
setWindowModality(Qt::WindowModal);
setVisible(false);
TitleElement.SetFont(QFont("Times New Roman",24));
SubtitleElement.SetFont(QFont("Times New Roman",18));
ComposerElement.SetFont(QFont("Times New Roman",12));
NamesElement.SetFont(QFont("Times New Roman",8));
connect(ui->topMargin,SIGNAL(Changed()),this,SLOT(UpdateMargins()));
connect(ui->leftMargin,SIGNAL(Changed()),this,SLOT(UpdateMargins()));
connect(ui->rightMargin,SIGNAL(Changed()),this,SLOT(UpdateMargins()));
connect(ui->bottomMargin,SIGNAL(Changed()),this,SLOT(UpdateMargins()));
connect(ui->tabWidget,SIGNAL(currentChanged(int)),this,SLOT(UpdateMargins()));
connect(ui->NoteSpace,SIGNAL(valueChanged(int)),this,SLOT(SpacingTooltip(int)));
ui->graphicsView->setScene(&S);
Printer=new QPrinter();
pageSetupButton=new QToolButton(ui->graphicsView);
pageSetupButton->setProperty("transparent",true);
pageSetupButton->setIcon(QIcon(":/preferences.png"));
pageSetupButton->setIconSize(QSize(32,32));
pageSetupButton->setFixedSize(QSize(36,36));
connect(pageSetupButton,SIGNAL(clicked()),this,SLOT(ShowPageSetup()));
UpdateMargins();
}
示例15: QWidget
Menu::Menu(QWidget *parent) :
QWidget(parent),
ui(new Ui::Menu)
{
ui->setupUi(this);
setWindowFlags(Qt::WindowStaysOnTopHint);
setWindowModality(Qt::ApplicationModal);
setWindowTitle("Tandem Techies");
setFixedSize(geometry().width(), geometry().height());
QIcon icon(":/images/player.png");
setWindowIcon(icon);
QLabel* background = new QLabel(this);
QPixmap backgroundImg(":/images/bg.png");
background->setPixmap(backgroundImg);
background->setGeometry(0, 0, geometry().width(), geometry().height());
background->setScaledContents(true);
background->lower();
background->show();
//Make the logo's background transparent
ui->lblLogo->setAttribute(Qt::WA_TranslucentBackground);
//Make the menu border invisible
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint);
setWindowFlags(Qt::CustomizeWindowHint);
setWindowFlags(Qt::FramelessWindowHint);
}