Fwd: Too big toolbars

Andras Mantia amantia at freemail.hu
Sat Mar 8 07:57:52 GMT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Forwarding to core-devel, as there may be (more) people who knows the 
answer...



- ----------  Forwarded Message  ----------

Subject: Too big toolbars
Date: 2003. March 07., Friday 22:27
From: Andras Mantia <amantia at freemail.hu>
To: kde-devel at mail.kde.org

Hi,

 I've experienced an undesired behavior of KToolBar-s on a QTabWidget. Quanta
uses the KToolBar-s in a not so common way by putting them on a QTabWidget.
When the toolbar contains too much icons, the QTabWidget resizes itself, so
icons they can  fit on it. The problem is when there are really too much, or
the user wants to have text under/alongside icons. In this case the
QTabWidget can easily become so wide, that it cannot fit on screen anymore.
And what is really bad, that it cannot even be resized. If I set a maximum
value for the QTabWidget with, than the toolbar will not grow the QTabWidget,
but will show an arrow after the last icon, and you can access the other
icons of the toolbar by clicking on it. The problem is, that if I set a
maximum width for the QTabWidget and resize the main window, it will not fill
up the whole area reserved for it. Setting a new max. width on every resize
is also not quite good, as once the window is enlarged, you cannot shrink it
anymore, due to the large toolbar on QTabWidget. The desired behaviour would
be to let the main window be resizable, and if the toolbar does not fit in
its area, show the arrows after the last icon. (just like in case of normal
application toolbars). You may try it with Quanta, especially if you have
"Text alongside icons" set, but even in normal case you can see that you
cannot make the editor widget smaller in width than the toolbar with the most
icons.
 Does anyone know how can this be achieved?
The code what I'm using is:

  m_toolbarTab = new QTabWidget(this);
  m_toolbarTab ->setTabPosition( QTabWidget::Top );
  m_toolbarTab ->setFocusPolicy( QWidget::NoFocus );

  QGridLayout *layout = new QGridLayout( this );
  layout->setRowStretch(0,0);
  layout->setRowStretch(1,1);
  layout->addWidget( m_toolbarTab     ,0,0);
  layout->addWidget( m_writeTab     ,1,0); //not important, another tab
 widget is added

In the KMainWindow::createContainer():
    KToolBar *tb = new KToolBar(m_view->toolbarTab(),
element.attribute("name"), true, true);
    tb->loadState(element);
    m_view->toolbarTab()->addTab(tb, i18n(tabname));

m_view->toolbarTab() returns the above m_toolbarTab.

Andras

PS: It's a pain using the KToolBar in a non-standard way, but this is a
problem that I cannot solve. :-( It has also other problems, but not so
important ones, like it does not have a context menu (even if I call the
setEnableContextMenu(true)).


- -- 
Quanta Plus developer - http://quanta.sourceforge.net
K Desktop Environment - http://www.kde.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+aaKATQdfac6L/08RArzEAJsFKHYEmg0mwomjIWP9hY3cm0BpPQCfX2Wo
dHD31bWH4mBOouPdQ1N4vFg=
=vid2
-----END PGP SIGNATURE-----





More information about the kde-core-devel mailing list