Qt-interest Archive, March 2002
Toolbar hangs under Win 98!
Message 1 in thread
Hi All!
I need to implement expandable toolbar in my app. Particularly, i need it to
be 5 buttons wide, but when user presses its last button it must expands and
show 14 buttons and vice versa. I use the following code to change toolbar
buttons number:
void CFullscreenToolBar::setButtons(CMainWnd *mainWnd, bool isFullSet)
{
QIconSet is;
CFullscreenWnd *parentWnd = dynamic_cast<CFullscreenWnd*>(parent());
if(!parentWnd)
throw CMAException("Can't get parent in
CFullscreenToolBar::setButtons()");
clear();
// drag area
CLineHeader *line1 = new CLineHeader(this);
line1->setFrameShadow(QFrame::Raised);
line1->setMaximumHeight(32);
line1->setLineWidth(1);
line1->setFrameShape(QFrame::VLine);
boxLayout()->addWidget(line1);
// adding buttons
if(isFullSet)
{
mainWnd->m_PrevAction->addTo(this);
mainWnd->m_NextAction->addTo(this);
mainWnd->m_AutoPlayAction->addTo(this);
mainWnd->m_FullscreenPlayAction->addTo(this);
mainWnd->m_SettingsAction->addTo(this);
mainWnd->m_PrintPictureAction->addTo(this);
mainWnd->m_FullscreenAction->addTo(this);
mainWnd->m_BookmarksAction->addTo(this);
QGuardedPtr<QToolButton> bookmarksButton =
(QToolButton*) child("BA_action_button");
if(bookmarksButton)
{
bookmarksButton->setPopup(mainWnd->m_BookmarksMenu);
// setting the button popup menu delay
bookmarksButton->setPopupDelay(0);
}
else
throw CMAException("Can't get bookmarks button from bookmarks
action in "
"CFullscreenToolBar::setButtons()");
mainWnd->m_SendPictureViaEmailAction->addTo(this);
mainWnd->m_FileSaveAsAction->addTo(this);
mainWnd->m_FileExportToHTMLAction->addTo(this);
mainWnd->m_FilePrintCalendarAction->addTo(this);
QWhatsThis::whatsThisButton(this);
parentWnd->m_ExpandAction->addTo(this);
m_IsExpanded = true;
is.setPixmap(QPixmap(xpmMinimize_toolbar), QIconSet::Small);
parentWnd->m_ExpandAction->setIconSet(is);
}
else
{
mainWnd->m_PrevAction->addTo(this);
mainWnd->m_NextAction->addTo(this);
mainWnd->m_AutoPlayAction->addTo(this);
mainWnd->m_FullscreenPlayAction->addTo(this);
parentWnd->m_ExpandAction->addTo(this);
m_IsExpanded = false;
is.setPixmap(QPixmap(xpmMaximize_toolbar), QIconSet::Small);
parentWnd->m_ExpandAction->setIconSet(is);
}
}
This code works very well under Windows 2000, XP and NT, but hangs
application under Win98. So, what am i doing wrong?
Best regards,
Dmytro Ivanets