本文整理汇总了C++中QPushButton::move方法的典型用法代码示例。如果您正苦于以下问题:C++ QPushButton::move方法的具体用法?C++ QPushButton::move怎么用?C++ QPushButton::move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPushButton
的用法示例。
在下文中一共展示了QPushButton::move方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc,char** argv){
QApplication app(argc,argv);
/* 定义父窗口 并调整大小 显示 */
QDialog *parent=new QDialog();
parent->resize(400,300);
/* 定义父窗口中的组件指针 */
QLineEdit *username;
QLineEdit *userpasswd;
QPushButton *blogin;
QPushButton *bcancel;
/* 赋值 */
username=new QLineEdit(parent);
userpasswd=new QLineEdit(parent);
blogin=new QPushButton("login",parent);
bcancel=new QPushButton("cancel",parent);
/* 调整组件的位置 */
username->move(200,50);
userpasswd->move(200,100);
blogin->move(50,200);
bcancel->move(250,200);
parent->show();
/* 点击cancel按钮 关闭父窗口 */
QObject::connect(bcancel,
SIGNAL(clicked()),parent,SLOT(close()));
return app.exec();
}
示例2: setupScene
void FadeMessage::setupScene()
{
QGraphicsRectItem *parent = m_scene.addRect(0, 0, 800, 600);
parent->setPen(Qt::NoPen);
parent->setZValue(0);
QGraphicsPixmapItem *bg = m_scene.addPixmap(QPixmap(":/background.jpg"));
bg->setParentItem(parent);
bg->setZValue(-1);
for (int i = 1; i < 5; ++i)
for (int j = 2; j < 5; ++j) {
QGraphicsRectItem *item = m_scene.addRect(i * 50, (j - 1) * 50, 38, 38);
item->setParentItem(parent);
item->setZValue(1);
int hue = 12 * (i * 5 + j);
item->setBrush(QColor::fromHsv(hue, 128, 128));
}
QFont font;
font.setPointSize(font.pointSize() * 2);
font.setBold(true);
QFontMetrics fontMetrics(font);
int fh = fontMetrics.height();
QString sceneText = "Qt Everywhere!";
int sceneTextWidth = fontMetrics.width(sceneText);
QGraphicsRectItem *block = m_scene.addRect(50, 300, sceneTextWidth, fh + 3);
block->setPen(Qt::NoPen);
block->setBrush(QColor(102, 153, 51));
QGraphicsTextItem *text = m_scene.addText(sceneText, font);
text->setDefaultTextColor(Qt::white);
text->setPos(50, 300);
block->setZValue(2);
block->hide();
text->setParentItem(block);
m_message = block;
m_effect = new QGraphicsColorizeEffect;
m_effect->setColor(QColor(122, 193, 66));
m_effect->setStrength(0);
m_effect->setEnabled(true);
parent->setGraphicsEffect(m_effect);
QPushButton *press = new QPushButton;
press->setText(tr("Press me"));
connect(press, SIGNAL(clicked()), SLOT(togglePopup()));
m_scene.addWidget(press);
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
press->move(200, 210);
#else
press->move(300, 500);
#endif
}
示例3: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
m_clicks(0)
{
ui->setupUi(this);
connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));
connect(ui->lineEdit, SIGNAL(textChanged(QString)), ui->textEditDisplay, SLOT(setText(QString)));
connect(ui->textEdit, SIGNAL(textChanged()), this, SLOT(updateTextEditDisplay()));
connect(ui->pushButton, SIGNAL(pressed()), this, SLOT(updatePushButtonDisplay()));
connect(ui->pushButton, SIGNAL(released()), this, SLOT(updatePushButtonDisplay()));
connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(updateClickCount()));
connect(ui->radioButton1, SIGNAL(toggled(bool)), this, SLOT(updateRadioButtonDisplay()));
connect(ui->radioButton2, SIGNAL(toggled(bool)), this, SLOT(updateRadioButtonDisplay()));
connect(ui->checkBox, SIGNAL(stateChanged(int)), this, SLOT(updateCheckBoxDisplay()));
connect(ui->comboBox, SIGNAL(activated(int)), this, SLOT(updateComboBoxDisplay()));
connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(updateHorizontalSliderDisplay()));
QWidget *contents = new QWidget;
contents->setObjectName("contents");
contents->setFixedSize(QSize(500, 500));
QPushButton *topLeft = new QPushButton(contents);
topLeft->setObjectName("topLeft");
topLeft->setFixedSize(QSize(20,20));
topLeft->move(10, 10);
QPushButton *topRight = new QPushButton(contents);
topRight->setObjectName("topRight");
topRight->setFixedSize(QSize(20,20));
topRight->move(470, 10);
QPushButton *bottomLeft = new QPushButton(contents);
bottomLeft->setObjectName("bottomLeft");
bottomLeft->setFixedSize(QSize(20,20));
bottomLeft->move(10, 470);
QPushButton *bottomRight = new QPushButton(contents);
bottomRight->setObjectName("bottomRight");
bottomRight->setFixedSize(QSize(20,20));
bottomRight->move(470, 470);
ui->scrollArea->setWidget(contents);
QStandardItemModel *model = new QStandardItemModel(this);
model->setHorizontalHeaderLabels(QStringList() << tr("items"));
QStandardItem *parentItem;
for (int j = 0; j < 3; ++j) {
parentItem = model->invisibleRootItem();
for (int i = 0; i < 4; ++i) {
QStandardItem *item = new QStandardItem(QString("item %0").arg(i));
parentItem->appendRow(item);
parentItem = item;
}
}
ui->treeView->setModel(model);
}
示例4: getConfiguration
void Carrefour::getConfiguration(Position * p) {
QWidget * configWidget = new QWidget();
this->config->setQWidget(configWidget);
int taille = 50;
std::list<Route *>::iterator itRoutes;
for (itRoutes = this->routes.begin() ; itRoutes != this->routes.end() ; itRoutes++) {
Route * route = (Route *) *itRoutes;
if (*(route->getPosition()) == *p) {
this->config->setRoute(route);
QLabel * label = new QLabel("Route", configWidget);
label->move(200, taille);
taille += 50;
}
}
std::list<Vehicule *>::iterator itVehicule;
for (itVehicule = this->objetRoutes.begin() ; itVehicule != this->objetRoutes.end() ; itVehicule++) {
Vehicule * vehicule = (Vehicule *) *itVehicule;
if (*(vehicule->getPosition()) == *p) {
this->config->setVehicule(vehicule);
QLabel * label = new QLabel(QString::fromStdString(vehicule->getType()), configWidget);
label->move(200, taille);
taille += 50;
QLabel * labelPositionArrivee = new QLabel("Position d'arrivee", configWidget);
labelPositionArrivee->move(50, taille);
QLabel * labelX = new QLabel("X : ", configWidget);
labelX->move(150, taille);
QTextEdit * xTextEdit = new QTextEdit(configWidget);
xTextEdit->move(180, taille);
xTextEdit->setFixedSize(50, 30);
this->config->setXTextEdit(xTextEdit);
QLabel * labelY = new QLabel("Y : ", configWidget);
labelY->move(250, taille);
QTextEdit * yTextEdit = new QTextEdit(configWidget);
yTextEdit->move(280, taille);
yTextEdit->setFixedSize(50, 30);
this->config->setYTextEdit(yTextEdit);
taille += 50;
QLabel * labelNbVehicule = new QLabel("Nb vehicule : ", configWidget);
labelNbVehicule->move(50, taille);
QTextEdit * nbVehiculeTextEdit = new QTextEdit(configWidget);
nbVehiculeTextEdit->move(150, taille);
nbVehiculeTextEdit->setFixedSize(50, 30);
taille += 50;
}
}
QPushButton * valideButton = new QPushButton("valide", configWidget);
QObject::connect(valideButton, SIGNAL(clicked()), this, SLOT(valideConfig()));
valideButton->move(100, taille);
QPushButton * annuleButton = new QPushButton("annule", configWidget);
QObject::connect(annuleButton, SIGNAL(clicked()), this, SLOT(annuleConfig()));
annuleButton->move(300, taille);
configWidget->show();
}
示例5: QPushButton
void MyScrollAreaWidget::test4f()
{
m_ScrollAreaWidgetContents = new QWidget;
m_ScrollAreaWidgetContents->setGeometry(0, 0, 200, 1000);
m_ScrollAreaWidgetContents->setMinimumSize(200, 1000);
QPushButton* pBtn = new QPushButton(m_ScrollAreaWidgetContents);
pBtn->setGeometry(0, 0, 200, 30);
pBtn->setMinimumSize(200, 30);
pBtn->show();
//pPnt->setWidget(pBtn);
pBtn = new QPushButton(m_ScrollAreaWidgetContents);
pBtn->setGeometry(0, 30, 200, 30);
pBtn->setMinimumSize(200, 30);
pBtn->move(0, 30);
pBtn->show();
//pPnt->setWidget(pBtn);
pBtn = new QPushButton(m_ScrollAreaWidgetContents);
pBtn->setGeometry(0, 60, 200, 30);
pBtn->setMinimumSize(200, 30);
pBtn->show();
//pPnt->setWidget(pBtn);
this->setWidget(m_ScrollAreaWidgetContents);
}
示例6: main
int main(int argc,char** argv){
QApplication app(argc,argv);
QDialog *parent;
QLineEdit *add;
QLabel *oper;
QLineEdit *added;
QPushButton *equ;
QLineEdit *res;
/* 指针赋值 */
parent=new QDialog();
parent->resize(650,300);
/* 给界面中组件指针赋值 */
add=new QLineEdit(parent);
oper=new QLabel("+",parent);
added=new QLineEdit(parent);
equ=new QPushButton("=",parent);
res=new QLineEdit(parent);
/* 调整位置 */
add->move(20,130);
oper->move(170,130);
added->move(220,130);
equ->move(360,130);
res->move(470,130);
parent->show();
return app.exec();
}
示例7: 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()));
}
示例8: main
int main(int argc,char** argv){
QApplication app(argc,argv);
QDialog *parent=new QDialog();
parent->resize(650,200);
/* 定义父窗口中的组件指针 */
QLineEdit *add;
QLabel *oper;
QLineEdit *added;
QPushButton *equ;
QLineEdit *res;
/* 赋值 */
add=new QLineEdit(parent);
oper=new QLabel("+",parent);
added=new QLineEdit(parent);
equ=new QPushButton("=",parent);
res=new QLineEdit(parent);
/* 调整组件的位置 */
add->move(20,80);
oper->move(170,80);
added->move(220,80);
equ->move(370,80);
res->move(480,80);
parent->show();
return app.exec();
}
示例9: WallpaperWidget
QGraphicsItem *WallpaperChange::item() {
QPushButton *button = new QPushButton("Change Wallpaper", 0);
button->move(10, 10);
connect(button, SIGNAL(clicked(bool)), this, SLOT(changeWallpaper(bool)));
return new WallpaperWidget(QRectF(0, 0, 340, 240), button);
}
示例10: QWidget
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
QPushButton *btn ;//= new QPushButton(this);
QList <QPushButton*> list;
QList<QString> list1;
QStringList list2;
list2<<"aa"<<"bb"<<"cc"<<"dd";
list2.append("aa");
list2[2]="zz";
for(int i=0; i<10; i++)
{
btn = new QPushButton(this);
btn->move(0, i*20);
list.append(btn);
if(list2.length()>i)
btn->setText(list2.at(i));
}
list.clear();
}
示例11: displayNewUpdate
void CustomMessageBox::displayNewUpdate()
{
setFixedSize(434, 179);
_label->setText("Une version plus récente de Multifacile est disponible, veux-tu la télécharger ?");
_label->setWordWrap(true);
_label->move(45, 50);
_menu->move(376, 0);
_okBouton->setText(tr("Oui"));
_okBouton->move(346, 135);
QPushButton *No = new QPushButton(tr("Non"), this);
No->setAttribute(Qt::WA_TranslucentBackground);
No->move(386, 140);
No->setObjectName("NoButton");
No->setStyleSheet("QPushButton#NoButton{background-color: rgba(255, 255, 255, 0);color: rgb(144,191,79); background-image: url(none);}");
disconnect(_okBouton, SIGNAL(clicked()), this, SLOT(close()));
connect(_okBouton, SIGNAL(clicked()), this, SLOT(accept()));
connect(No, SIGNAL(clicked()), this, SLOT(reject()));
}
示例12: setCurrentIndex
void HorizontalTabWidget::setCurrentIndex(int index)
{
int xPos = 0;
for(unsigned i = 0; i < m_tabButtons.size(); i++)
{
QPushButton * button = m_tabButtons[i];
QString style;
style.append("QPushButton { border: none; background-color: #808080; ");
style.append(" border-right: 1px solid black;");
style.append(" border-bottom: 1px solid black;");
style.append(" padding-left: 10px;");
style.append(" padding-right: 10px;");
style.append(" padding-top: 5px;");
style.append(" font: bold;");
if( i == m_tabButtons.size() - 1 )
{
style.append(" border-right: none;");
}
style.append("}");
button->setStyleSheet(style);
button->adjustSize();
button->move(xPos,0);
xPos = xPos + button->width();
}
m_tabBarLine->setFixedWidth(xPos);
m_tabBarLine->raise();
QPushButton * button = m_tabButtons[index];
QString style;
// NOTE: Yellow Orange Lighter #fdbc3b and the Darker Orange is #f47920
style.append("QPushButton { border: none; background-color: #f47920; ");
style.append(" border-right: 1px solid black;");
style.append(" padding-left: 10px;");
style.append(" padding-right: 10px;");
style.append(" padding-top: 5px;");
style.append(" font: bold;");
if( index == int(m_tabButtons.size() - 1) )
{
style.append(" border-right: none;");
}
style.append("}");
button->setStyleSheet(style);
button->raise();
emit tabSelected(m_ids[index]);
}
示例13: setCurrentIndex
void HorizontalTabWidget::setCurrentIndex(int index)
{
int xPos = 0;
for(unsigned i = 0; i < m_tabButtons.size(); i++)
{
QPushButton * button = m_tabButtons[i];
QString style;
style.append("QPushButton { border: none; background-color: #808080; ");
style.append(" border-right: 1px solid black;");
style.append(" border-bottom: 1px solid black;");
style.append(" padding-left: 10px;");
style.append(" padding-right: 10px;");
style.append(" padding-top: 5px;");
style.append(" color: white;");
if( i == m_tabButtons.size() - 1 )
{
style.append(" border-right: none;");
}
style.append("}");
button->setStyleSheet(style);
button->adjustSize();
button->move(xPos,0);
xPos = xPos + button->width();
}
m_tabBarLine->setFixedWidth(xPos);
m_tabBarLine->raise();
QPushButton * button = m_tabButtons[index];
QString style;
style.append("QPushButton { border: none; background-color: #95B3DE; ");
style.append(" border-right: 1px solid black;");
style.append(" padding-left: 10px;");
style.append(" padding-right: 10px;");
style.append(" padding-top: 5px;");
style.append(" color: white;");
if( index == int(m_tabButtons.size() - 1) )
{
style.append(" border-right: none;");
}
style.append("}");
button->setStyleSheet(style);
button->raise();
m_pageStack->setCurrentIndex(index);
}
示例14: CreateMsgButton
void CreateMsgButton(QMainWindow* window)
{
QMessageBox* message = new QMessageBox(window);
message->setText("Message text");
QPushButton* button = new QPushButton("Message", window);
button->move(85, 40);
button->resize(80, 25);
button->show();
QObject::connect(button, SIGNAL(released()), message, SLOT(exec()));
}
示例15: setCurrentIndex
void VerticalTabWidget::setCurrentIndex(int index)
{
int yPos = 25;
for(unsigned i = 0; i < m_tabButtons.size(); i++)
{
QPushButton * button = m_tabButtons[i];
button->move(0,yPos);
yPos = yPos + button->height();
QString imagePath;
QString style;
if (i == static_cast<unsigned>(index))
{
imagePath = m_selectedPixmaps[i];
// Ignore clicks to the already active tab
if(currentIndex != index){
currentIndex = index;
style.append("QPushButton { background-color: blue; background-image: url(\"");
style.append(imagePath);
style.append("\"); border: none; background-repeat: 0; }");
button->setStyleSheet(style);
currentIndex = index;
emit tabSelected(m_ids[index]);
}
}
else
{
if (button->isEnabled()){
imagePath = m_unSelectedPixmaps[i];
style.append("QPushButton { background-image: url(\"");
style.append(imagePath);
style.append("\"); border: none; background-color: red; background-repeat: 0; }");
}
else {
imagePath = m_disabledPixmaps[i];
style.append("QPushButton { background-image: url(\"");
style.append(imagePath);
style.append("\"); border: none; background-color: red; background-repeat: 0; }");
}
button->setStyleSheet(style);
}
}
}