[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Corner widgets in a QTabBar
From:       Stefan Majewsky <majewsky () gmx ! net>
Date:       2009-09-28 14:27:09
Message-ID: 200909281627.16170.majewsky () gmx ! net
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


Hi,

I'm currently working on some innovative interface layout. For this, I want to 
put some widget inside a tab bar. This works reasonably well with 
QTabWidget::setCornerWidget, but the inserted widget does not completely fill 
the free area of the QTabBar (see attached example code, can be compiled with 
QMake). Setting the horizontal size policy of the inserted widget to Minimum

The question is: Is there a way to insert a widget into a QTabBar in such a 
way that it always fills the free area completely?

Greetings
Stefan

["tabbartest.cpp" (text/x-c++src)]

#include <QApplication>
#include <QLabel>
#include <QProgressBar>
#include <QTabWidget>

int main(int argc, char** argv)
{
	QApplication app(argc, argv);

	//create a dummy tab widget
	QTabWidget tabWidget;
	tabWidget.addTab(new QLabel("This is page 1."), "Page 1");
	tabWidget.addTab(new QLabel("This is page 2."), "Page 2");
	tabWidget.addTab(new QLabel("This is page 3."), "Page 3");

	//create a dummy progress bar
	QProgressBar* progressBar = new QProgressBar;
	progressBar->setRange(0, 100);
	progressBar->setValue(60);

	//the interesting part: put the progress bar inside the tab bar
	tabWidget.setCornerWidget(progressBar, Qt::TopRightCorner);
	//The result looks good until one stretches the window. The progressbar just uses \
its size hint, but I would like it to totally fill the possible area. Is this \
possible?

	tabWidget.show();
	return app.exec();
}


["signature.asc" (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic