本文整理汇总了C++中QDialog::move方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::move方法的具体用法?C++ QDialog::move怎么用?C++ QDialog::move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialog
的用法示例。
在下文中一共展示了QDialog::move方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zeitanzeige
void gesamtbild::zeitanzeige(/*int dora, int hin, int may*/)
{
qWarning() << "Zeit";
QDialog *zeitw = new QDialog(this);
QVBoxLayout layout(zeitw);
QLabel *anzeige = new QLabel(tr("Time: Day %1,").arg(GAMEDATA->gametime().day()).append(QString("%1 hours").arg(GAMEDATA->gametime().hour())), zeitw);
// anzeige->setText(anzeige->text().append(QString(", %2 Uhr %3").arg( gameview->stunde, gameview->minute)));gameview->stunde
// qWarning() << anzeige->text().append(QString(", %2 Uhr %3").arg( gameview->stunde, gameview->minute));
QPushButton *ok = new QPushButton("Ok",zeitw);
ok->move(50, 50);
layout.addWidget(anzeige);
layout.addWidget(ok);
// zeitw->setGeometry(width()/2,height()/2,200,100);
zeitw->setLayout(&layout);
zeitw->setAutoFillBackground(true);
zeitw->move(gameview->width()/2,gameview->height()/2);
zeitw->raise();
zeitw->show();
connect(ok, SIGNAL(clicked()), gameview, SLOT(endePause()));
connect(ok, SIGNAL(clicked()), zeitw, SLOT(close()));
connect(ok, SIGNAL(clicked()), zeitw, SLOT(deleteLater()));
}
示例2: mousePressEvent
void MenuButton::mousePressEvent ( QGraphicsSceneMouseEvent * event ) {
QGraphicsItem::mousePressEvent(event);
if(event->button() != Qt::LeftButton) return;
if(currentMenu) {
currentMenu->setFocus(); //BUG: doesnt seem to work
return;
}
QDialog *menu = new QDialog(panelWindow);
menu->move(event->screenPos().x(), event->screenPos().y());
QVBoxLayout *layout = new QVBoxLayout();
QCheckBox *editModeCheck = new QCheckBox("Edit Panel", menu);
editModeCheck->setChecked(editMode);
connect(editModeCheck, SIGNAL(clicked(bool)), panelWindow, SLOT(setEditMode(bool)));
connect(editModeCheck, SIGNAL(clicked(bool)), this, SLOT(setEditMode(bool)));
layout->addWidget(editModeCheck);
QPushButton *addButton = new QPushButton("Add Item", menu);
connect(addButton, SIGNAL(clicked()), panelWindow, SLOT(addItem()));
layout->addWidget(addButton);
QPushButton *saveButton = new QPushButton("Save panel", menu);
connect(saveButton, SIGNAL(clicked()), panelWindow, SLOT(savePanel()));
layout->addWidget(saveButton);
QPushButton *loadButton = new QPushButton("Load panel", menu);
connect(loadButton, SIGNAL(clicked()), panelWindow, SLOT(loadPanel()));
layout->addWidget(loadButton);
QPushButton *settingsButton = new QPushButton("App Settings", menu);
connect(settingsButton, SIGNAL(clicked()), panelWindow, SLOT(showSettings()));
connect(settingsButton, SIGNAL(clicked()), this, SLOT(closeCurrentMenu()));
layout->addWidget(settingsButton);
QPushButton *closeButton = new QPushButton("Close", menu);
connect(closeButton, SIGNAL(clicked()), this, SLOT(closeCurrentMenu()));
layout->addWidget(closeButton);
QPushButton *quitButton = new QPushButton("Quit", menu);
connect(quitButton, SIGNAL(clicked()), panelWindow, SLOT(quit()));
layout->addWidget(quitButton);
currentMenu = menu;
connect(currentMenu, SIGNAL(finished(int)), this, SLOT(closeCurrentMenu()));
menu->setLayout(layout);
menu->setModal(false);
menu->show();
}
示例3: restoreState
//-----------------------------------------------------------------------------
void ctkSettings::restoreState(const QString& key, QDialog& dialog)
{
this->beginGroup(key);
if(this->contains("Size"))
{
dialog.resize(this->value("Size").toSize());
}
if(this->contains("Position"))
{
dialog.move(this->value("Position").toPoint());
}
this->endGroup();
}
示例4: on_actionYearlyStatistics_triggered
void MainWindow::on_actionYearlyStatistics_triggered()
{
QDialog d;
QVBoxLayout *l = new QVBoxLayout(&d);
YearlyStatisticsModel *m = new YearlyStatisticsModel();
QTreeView *view = new QTreeView();
view->setModel(m);
l->addWidget(view);
d.resize(width() * .8, height() / 2);
d.move(width() * .1, height() / 4);
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), &d);
connect(close, SIGNAL(activated()), &d, SLOT(close()));
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), &d);
connect(quit, SIGNAL(activated()), this, SLOT(close()));
d.setWindowFlags(Qt::Window | Qt::CustomizeWindowHint
| Qt::WindowCloseButtonHint | Qt::WindowTitleHint);
d.setWindowTitle(tr("Yearly Statistics"));
d.exec();
}
示例5: editorEvent
bool ButtonDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
{
if (event->type() == QEvent::MouseButtonPress) {
QMouseEvent* e =(QMouseEvent*)event;
if (option.rect.adjusted(4, 4, -4, -4).contains(e->x(), e->y()) && m_btns.contains(index)) {
m_btns.value(index)->state |= QStyle::State_Sunken;
}
}
if (event->type() == QEvent::MouseButtonRelease) {
QMouseEvent* e =(QMouseEvent*)event;
if (option.rect.adjusted(4, 4, -4, -4).contains(e->x(), e->y()) && m_btns.contains(index)) {
m_btns.value(index)->state &= (~QStyle::State_Sunken);
QDialog *d = new QDialog();
d->setGeometry(0, 0, 200, 200);
d->move(QApplication::desktop()->screenGeometry().center() - d->rect().center());
d->show();
}
}
}