Hi,
I have qtabwidget with corner widget. I added QToolButton as corner widget.
btnMenu->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
btnMenu->setAutoRaise(true);
btnMenu
->setIcon
(QIcon::fromTheme("tab-new"));
btnMenu->setText(trUtf8("Pars"));
btnMenu->setMenu(menu);
setCornerWidget(btnMenu,Qt::TopLeftCorner);
btnMenu = new QToolButton(this);
btnMenu->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
btnMenu->setAutoRaise(true);
btnMenu->setIcon(QIcon::fromTheme("tab-new"));
btnMenu->setText(trUtf8("Pars"));
btnMenu->setShortcut(QKeySequence::AddTab);
btnMenu->setMenu(menu);
btnMenu->setPopupMode(QToolButton::MenuButtonPopup);
setCornerWidget(btnMenu,Qt::TopLeftCorner);
To copy to clipboard, switch view to plain text mode
And I have "mouseRelaseEvent" for tabwidget like this:
{
if (event->button() == Qt::MidButton)
{
int index = tabBar()->tabAt(event->pos());
if (index != -1)
{
this->removeTab(index);
qDebug
() <<
QString::number(index
);
return;
}
else
{
return;
}
}
PTabWidget::mouseReleaseEvent(event);
}
void PTabWidget::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::MidButton)
{
int index = tabBar()->tabAt(event->pos());
if (index != -1)
{
this->removeTab(index);
qDebug() << QString::number(index);
return;
}
else
{
return;
}
}
PTabWidget::mouseReleaseEvent(event);
}
To copy to clipboard, switch view to plain text mode
When I click with mid-button to tabbar, the output is "The program has unexpectedly finished.". But when i remove the tool button, it works fine. Is it bug or I miss something ??
Sorry for my poor English.
Best regards.
Bookmarks