PDA

View Full Version : resize buttons inside



eleanor
16th October 2007, 22:21
Hi, take a look at the code:



class vnosTab : public QTabWidget {
public:
vnosTab();

private:
QVBoxLayout *m_pTopLayoutVnos;

QPushButton *m_pVnosUvoznihCarinskih;
QPushButton *m_pVnosUvoznihNecarinskih;
QPushButton *m_pVnosIzvoznihCarinskih;
QPushButton *m_pVnosIzvoznihNecarinskih;
};




vnosTab::vnosTab() {
m_pTopLayoutVnos = new QVBoxLayout;
Q_CHECK_PTR(m_pTopLayoutVnos);

//buttons in tab "Vnos"
m_pVnosUvoznihCarinskih = new QPushButton(trUtf8("uvoznih carinskih pošiljk"));
Q_CHECK_PTR(m_pVnosUvoznihCarinskih);
m_pVnosUvoznihNecarinskih = new QPushButton(trUtf8("uvoznih necarinskih pošiljk"));
Q_CHECK_PTR(m_pVnosUvoznihNecarinskih);
m_pVnosIzvoznihCarinskih = new QPushButton(trUtf8("izvoznih carinskih pošiljk"));
Q_CHECK_PTR(m_pVnosIzvoznihCarinskih);
m_pVnosIzvoznihNecarinskih = new QPushButton(trUtf8("izvoznih necarinskih pošiljk"));
Q_CHECK_PTR(m_pVnosIzvoznihNecarinskih);

m_pTopLayoutVnos->addWidget(m_pVnosUvoznihCarinskih);
m_pTopLayoutVnos->addWidget(m_pVnosUvoznihNecarinskih);
m_pTopLayoutVnos->addWidget(m_pVnosIzvoznihCarinskih);
m_pTopLayoutVnos->addWidget(m_pVnosIzvoznihNecarinskih);

this->setLayout(m_pTopLayoutVnos);
}



here I'm using the previously declared class


void qKobilica::addToolMenu() {
setWindowTitle("Kobilica:");
m_pTopLayout = new QVBoxLayout();
m_pToolbox = new QToolBox;

m_pTabSifrant = new QTabWidget;
m_pTabVnos = new vnosTab();
//m_pTabVnos->setHorizontalPolicy(QSizePolicy::Maximum);
m_pTabNatisni = new QTabWidget;

//tabs
m_pToolbox->addItem(m_pTabSifrant,trUtf8("Šifranti"));
m_pToolbox->addItem(m_pTabVnos,trUtf8("Vnos"));
m_pToolbox->addItem(m_pTabNatisni,trUtf8("Tiskanje"));
m_pTopLayout->addWidget(m_pToolbox);
//add the central menu to the application
setCentralWidget(m_pToolbox);

}

What I want to do is to resize the buttons (there are 4 at the moment) that would fill the whole canvas (now there's some space in between those buttons), I want only buttons to be on the screen.

Shawn
17th October 2007, 01:53
probably this is what you are looking for:
void QBoxLayout::setSpacing ( int spacing ):p

eleanor
17th October 2007, 07:06
This is not what I'm looking for.

I want to set size of buttons according to QToolBox's size.

Shawn
17th October 2007, 07:23
then what do you mean by "there's some space in between those buttons" ?

A captured pic may describe your peoblem more easily:p

eleanor
17th October 2007, 07:26
Here:

http://shrani.si/f/1I/Ll/35PBS70r/snapshot24.png

You see those buttons not using all the space?

eleanor
17th October 2007, 14:43
Does anybody know?

Gopala Krishna
17th October 2007, 14:54
Try setting this sizepolicy for all the buttons

button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

eleanor
17th October 2007, 15:17
You're the man, it works. Thank you

MarkoSan
21st October 2007, 05:21
eleanor, but that widget is way to big!!!! Make it smaller!!!!