标签:style blog http color io ar strong sp div
*窗口部件布局:
微调器:QSpinBox
滑块 : QSLider
*三大部件管理器:
水平: QHBoxLayout
垂直:QVBoxLayout
网格: QGridLayout
*信号——槽连接和布局:
connect(发射信号,宏SIGNAL(信号), 接受信号, 宏SLOT(槽))
#include "mainwindow.h" #include <QApplication> #include <QHBoxLayout> #include <QSlider> #include <QSpinBox> int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget *window = new QWidget; window->setWindowTitle("Enter Your Age"); QSpinBox *spinbox = new QSpinBox; QSlider *slider = new QSlider(Qt::Horizontal); spinbox->setRange(0, 100); slider->setRange(0, 100); QObject::connect(spinbox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int))); QObject::connect(slider, SIGNAL(valueChanged(int)), spinbox, SLOT(setValue(int))); spinbox->setValue(35); QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(spinbox); layout->addWidget(slider); window->setLayout(layout); window->show(); return app.exec(); }
新手上路,欢迎交流!
标签:style blog http color io ar strong sp div
原文地址:http://www.cnblogs.com/qiu0130/p/4006233.html