Yes I'am using layouts.
Here Is the code, it might give a better picture of what im trying to do:
#include <QLabel>
#include <QPushButton>
#include <QGraphicsView>
#include <QLineEdit>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QApplication>
#include <QCheckBox>
#include "browseimages.h"
{
// Title of the window
this->setWindowTitle("Browse Images");
this->resize(700, 400); // I'm using your old values
b_search->setFixedHeight(40);
b_exit->setFixedHeight(40);
h_exit->addStretch();
h_exit->addWidget(b_exit);
h_exit->addStretch();
connect(b_exit, SIGNAL(clicked()), qApp, SLOT(quit()));
l_welcome
= new QLabel(tr
("--Browse Images--"));
l_welcome
->setFont
(QFont("Times",
18,
QFont::Bold));
l_welcome->setAlignment(Qt::AlignCenter);
g_graphics->scale(50,70);
v_1->setAlignment(Qt::AlignCenter);
v_1->addSpacing(30);
v_1->addWidget(b_search);
v_e->setAlignment(Qt::AlignCenter);
v_e->addWidget(b_exit);
v_g->setAlignment(Qt::AlignCenter);
v_g->addWidget(g_graphics);
layout_vert->setAlignment(Qt::AlignTop);
layout_vert->addWidget(l_welcome);
layout_vert->addSpacing(30);
layout_vert->addLayout(v_g);
layout_vert->addSpacing(20);
layout_vert->addLayout(v_1);
layout_vert->addSpacing(20);
layout_vert->addLayout(v_e);
//layout_vert->addLayout(h_exit);
this->setLayout(layout_vert);
}
#include <QLabel>
#include <QPushButton>
#include <QGraphicsView>
#include <QLineEdit>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QApplication>
#include <QCheckBox>
#include "browseimages.h"
BrowseImages::BrowseImages(QWidget *parent) : QWidget(parent)
{
// Title of the window
this->setWindowTitle("Browse Images");
this->resize(700, 400); // I'm using your old values
b_search = new QPushButton(tr("SEARCH"));
b_search->setFixedHeight(40);
b_exit = new QPushButton(tr("Exit"));
b_exit->setFixedHeight(40);
QHBoxLayout *h_exit = new QHBoxLayout;
h_exit->addStretch();
h_exit->addWidget(b_exit);
h_exit->addStretch();
connect(b_exit, SIGNAL(clicked()), qApp, SLOT(quit()));
l_welcome = new QLabel(tr("--Browse Images--"));
l_welcome->setFont(QFont("Times", 18, QFont::Bold));
l_welcome->setAlignment(Qt::AlignCenter);
g_graphics = new QGraphicsView(this);
g_graphics->scale(50,70);
QHBoxLayout *v_1 = new QHBoxLayout;
v_1->setAlignment(Qt::AlignCenter);
v_1->addSpacing(30);
v_1->addWidget(b_search);
QHBoxLayout *v_e = new QHBoxLayout;
v_e->setAlignment(Qt::AlignCenter);
v_e->addWidget(b_exit);
QVBoxLayout *v_g = new QVBoxLayout;
v_g->setAlignment(Qt::AlignCenter);
v_g->addWidget(g_graphics);
QVBoxLayout *layout_vert = new QVBoxLayout;
layout_vert->setAlignment(Qt::AlignTop);
layout_vert->addWidget(l_welcome);
layout_vert->addSpacing(30);
layout_vert->addLayout(v_g);
layout_vert->addSpacing(20);
layout_vert->addLayout(v_1);
layout_vert->addSpacing(20);
layout_vert->addLayout(v_e);
//layout_vert->addLayout(h_exit);
this->setLayout(layout_vert);
}
To copy to clipboard, switch view to plain text mode
Thank You,
Bookmarks