标签:菜单栏
1.菜单栏上的弹出窗口
void MainWindow::on_new_action_triggered() { MyDialog myDialog;//MyDialog是一个ui myDialog.setModal(true); myDialog.exec(); /*******上面的写法弹出的窗口挡住后面的窗口***********/ /*******下面的写法弹出的窗口不挡住后面的窗口,并且可以弹出多个****/ // myDialog = new MyDialog(this); // myDialog->show(); }
2.水平布局&垂直布局
QWidget *window = new QWidget; window->setWindowTitle("Layout测试"); QPushButton *button1 = new QPushButton("one"); QPushButton *button2 = new QPushButton("two"); QPushButton *button3 = new QPushButton("three"); QHBoxLayout * hlayout = new QHBoxLayout; hlayout->addWidget(button1); hlayout->addWidget(button2); hlayout->addWidget(button3); window->setLayout(hlayout); window->show();
QVBoxLayout * hlayout = new QVBoxLayout;//垂直布局
本文出自 “阿凡达” 博客,请务必保留此出处http://shamrock.blog.51cto.com/2079212/1411247
标签:菜单栏
原文地址:http://shamrock.blog.51cto.com/2079212/1411247