mainwindow.h:
CODE
QWidget *WorkSpace;
QHBoxLayout *MainLayout;
QVBoxLayout *RightLayout1;
PaintArea *PaintArea1;
QLabel *WidthLabel;
QLabel *HeightLabel;
QLabel *XLabel;
QLabel *YLable;
QLineEdit *WidthLine;
QLineEdit *HeightLine;
QLineEdit *XLine;
QLineEdit *YLine;
QPushButton *PaintButton;
QHBoxLayout *MainLayout;
QVBoxLayout *RightLayout1;
PaintArea *PaintArea1;
QLabel *WidthLabel;
QLabel *HeightLabel;
QLabel *XLabel;
QLabel *YLable;
QLineEdit *WidthLine;
QLineEdit *HeightLine;
QLineEdit *XLine;
QLineEdit *YLine;
QPushButton *PaintButton;
mainwindow.cpp:
CODE
void MainWindow::CreateCentralwidgets()
{
WidthLine = new QLineEdit("0");
HeightLine = new QLineEdit("0");
XLine = new QLineEdit("0");
YLine = new QLineEdit("0");
WidthLabel = new QLabel(tr("<center>Width:</center>"));
HeightLabel = new QLabel(tr("<center>Height:</center>"));
XLabel = new QLabel(tr("<center>X:</center>"));
YLable = new QLabel(tr("<center>Y:</center>"));
PaintButton = new QPushButton(tr("Paint"));
PaintButton->setEnabled(false);
}
void MainWindow::ArrangementWidgets()
{
WorkSpace = new QWidget;
MainLayout = new QHBoxLayout;
RightLayout1 = new QVBoxLayout;
RightLayout1->addWidget(WidthLabel);
//RightLayout1->addWidget(WidthLine);
RightLayout1->addWidget(HeightLabel);
//RightLayout1->addWidget(HeightLine);
RightLayout1->addWidget(XLabel);
//RightLayout1->addWidget(XLine);
RightLayout1->addWidget(YLable);
//RightLayout1->addWidget(YLine);
RightLayout1->addWidget(PaintButton);
RightLayout1->addStretch();
MainLayout->addWidget(PaintArea1);
MainLayout->addLayout(RightLayout1);
WorkSpace->setLayout(MainLayout);
{
WidthLine = new QLineEdit("0");
HeightLine = new QLineEdit("0");
XLine = new QLineEdit("0");
YLine = new QLineEdit("0");
WidthLabel = new QLabel(tr("<center>Width:</center>"));
HeightLabel = new QLabel(tr("<center>Height:</center>"));
XLabel = new QLabel(tr("<center>X:</center>"));
YLable = new QLabel(tr("<center>Y:</center>"));
PaintButton = new QPushButton(tr("Paint"));
PaintButton->setEnabled(false);
}
void MainWindow::ArrangementWidgets()
{
WorkSpace = new QWidget;
MainLayout = new QHBoxLayout;
RightLayout1 = new QVBoxLayout;
RightLayout1->addWidget(WidthLabel);
//RightLayout1->addWidget(WidthLine);
RightLayout1->addWidget(HeightLabel);
//RightLayout1->addWidget(HeightLine);
RightLayout1->addWidget(XLabel);
//RightLayout1->addWidget(XLine);
RightLayout1->addWidget(YLable);
//RightLayout1->addWidget(YLine);
RightLayout1->addWidget(PaintButton);
RightLayout1->addStretch();
MainLayout->addWidget(PaintArea1);
MainLayout->addLayout(RightLayout1);
WorkSpace->setLayout(MainLayout);
Забыл сказать: если виджету PaintArea1 установить FixedSize(), то виджет видно, но мне нужно именно чтобы его размер менялся при растягивании окна.