PDA

View Full Version : probl;em in using QTabWidget



daskulajit
9th June 2009, 15:07
hi ,
I am using a QTabWidget to display 4 dialogs in 4 tab items. For that i have implementes my Dialogs using QHBoxLayout and QVBoxLayout. I tried with out using layout. but then the dialogs were not displayed. Since i am using Layout, i cannot use setGeometry() API to the items contained in the dialogs. But now there is another problem. When the dialogs are displayed , items are going out of the screen. The size of the screen i am using is 320H/240H. The items are going out horizontally in the right side of the screen.


ProxysettingWindow()
resize(240,320);
m_httpProxy = new QLabel("HttpProxy", this);
m_proxyEdit = new QLineEdit(settings.value("HttpHost").toString(), this) ;
m_httpPort = new QLabel("Httpport", this);
m_portEdit = new QLineEdit(settings.value("Httpport").toString(), this) ;
m_userName = new QLabel("UserName", this);
m_nameEdit = new QLineEdit(settings.value("UserName").toString(), this) ;
m_userpassword = new QLabel("Pasword", this);
m_passWordEdit = new QLineEdit(settings.value("Password").toString(), this) ;


QVBoxLayout *mainLayout = new QVBoxLayout();
QHBoxLayout *proxyLayout = new QHBoxLayout;
QHBoxLayout *portLayout = new QHBoxLayout;
QHBoxLayout *userNameLayout = new QHBoxLayout;
QHBoxLayout *passLayout = new QHBoxLayout;
proxyLayout->addWidget(m_httpProxy);
proxyLayout->addWidget(m_proxyEdit);
portLayout->addWidget(m_httpPort);
portLayout->addWidget(m_portEdit);
userNameLayout->addWidget(m_userName);
userNameLayout->addWidget(m_nameEdit);
passLayout->addWidget(m_userpassword);
passLayout->addWidget(m_passWordEdit);
mainLayout->addLayout(proxyLayout);
mainLayout->addLayout(portLayout);
mainLayout->addLayout(userNameLayout);
mainLayout->addLayout(passLayout);
mainLayout->addLayout(buttonLayout);
setLayout(mainLayout);
}

this is the code i have written in the const of the dialog



m_tabbar = new QTabWidget(this);
m_proxyWindow = new ProxysettingWindow(this);
m_tabbar->addTab(m_proxyWindow, "proxy");

this is how i created the Tabwidget

If anyone had faced such kind of problem, please provide some pointers.

Regards
Kulajit das

Lykurg
9th June 2009, 15:35
Well don't use resize(240,320) this is may be too narrow. better use adjustSize()/showMaximized() to get the best geometry for the widget. may be your font is to big?

((EDIT: I see your screen is only 240x320...))

Further it is normally not necessary to have private member variables for a Label etc, since you don't want to change the text at any point...


... and code tags have [ ] and not < >!

EDIT2: If you can't scale your font size etc down, you can use QSrollArea to be able to scroll.