--- Example.cpp ---
#include <QApplication>
#include <QWidget>
#include <QGridLayout>
#include <QPushButton>
#include <QScrollArea>
int main(int argc, char *argv[])
{
area.setWidget(test); // A
gl.setSpacing(0);
gl.setMargin(0);
gl.addWidget(&b0,0,0);
gl.addWidget(&b1,0,1);
gl.addWidget(&b2,1,0);
gl.addWidget(&b3,1,1);
gl.addWidget(&b4,2,0);
gl.addWidget(&b5,2,1);
// area.setWidget(test); // B
area.show();
return app.exec();
}
--- Example.cpp ---
--- Example.cpp ---
#include <QApplication>
#include <QWidget>
#include <QGridLayout>
#include <QPushButton>
#include <QScrollArea>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget *test = new QWidget;
QScrollArea area(0);
area.setWidget(test); // A
QGridLayout gl(test);
gl.setSpacing(0);
gl.setMargin(0);
QPushButton b0("1", test);
gl.addWidget(&b0,0,0);
QPushButton b1("2", test);
gl.addWidget(&b1,0,1);
QPushButton b2("3", test);
gl.addWidget(&b2,1,0);
QPushButton b3("4", test);
gl.addWidget(&b3,1,1);
QPushButton b4("5", test);
gl.addWidget(&b4,2,0);
QPushButton b5("6", test);
gl.addWidget(&b5,2,1);
// area.setWidget(test); // B
area.show();
return app.exec();
}
--- Example.cpp ---
To copy to clipboard, switch view to plain text mode
Bookmarks