I am trying QTitanRibbon 7.0.0 and have an issue, where I can not add a new button to an existing RibbonPage using a Qt connect.
Here is a small example.
#include <QApplication>
#include <QGroupBox>
#include <QToolButton>
#include <QVBoxLayout>
#include <QtitanRibbon.h>
#include <QtnRibbonMainWindow.h>
class MainWindow : public RibbonMainWindow
{
Q_OBJECT
public:
MainWindow()
: RibbonMainWindow()
{
auto groupBox = new QGroupBox( "Test", this );
auto button1 = new QToolButton( this );
button1->setText( "Add button to Ribbon" );
connect( button1, &QToolButton::clicked, this, [ this ]() {
RibbonGroup* group = ribbonBar()->page( 0 )->addGroup( "New Group" );
auto action2 = new QAction( "Button2", this );
connect( action2, &QAction::triggered, this, []() { qDebug() << "Button2"; } );
group->addAction( action2, Qt::ToolButtonTextUnderIcon );
} );
auto vLayout = new QVBoxLayout;
vLayout->addWidget( button1 );
groupBox->setLayout( vLayout );
setCentralWidget( groupBox );
{
auto page = ribbonBar()->addPage( tr( "Page1" ) );
RibbonGroup* group1 = page->addGroup( tr( "Group1" ) );
ribbonBar()->setFrameThemeEnabled( true );
auto action1 = new QAction( "Button1", this );
connect( action1, &QAction::triggered, this, []() { qDebug() << "Button1"; } );
group1->addAction( action1, Qt::ToolButtonTextUnderIcon );
}
setWindowTitle( tr( "MissingButton Test" ) );
}
};
int main( int argc, char* argv[] )
{
QApplication app( argc, argv );
MainWindow mw;
mw.resize( 640, 480 );
mw.show();
return app.exec();
}
#include "main.moc"
The example contains a Ribbon with 1 page with 1 group containing Button1. There is also a button "Add button to Ribbon" in the central widget of the GUI. When this button is clicked, it should add an additional RibbonGroup "New Group" containing Button2 to RibbonPage1.
This works with QTitanRibbon 6.8.0 ("New Group" and Button2 are created, when clicking "Add button to Ribbon"). See Screenshot1.
With QTitanRibbon 7.0.0 it does not work (on WIndows and Ubuntu 24.04). "New Group" is created, but Button2 is missing. See Screenshot2.
Is this a bug in QTitanRibbon 7.0.0?