MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / layoutButtons

Method layoutButtons

MiniZincIDE/outputwidget.cpp:1000–1027  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

998}
999
1000void OutputWidget::layoutButtons()
1001{
1002 auto neededWidth = 0;
1003 auto spacing = ui->sectionButtons_horizontalLayout->spacing();
1004 for (auto* b : ui->sectionButtons_widget->findChildren<QAbstractButton*>()) {
1005 neededWidth += b->sizeHint().width() + spacing;
1006 }
1007 for (auto* b : ui->messageTypeButtons_widget->findChildren<QAbstractButton*>()) {
1008 neededWidth += b->sizeHint().width() + spacing;
1009 }
1010 auto availableWidth = ui->buttons_widget->width();
1011
1012 if (availableWidth > neededWidth) {
1013 // Normal layout
1014 if (ui->sectionMenu_pushButton->isVisible()) {
1015 ui->sectionMenu_pushButton->hide();
1016 ui->messageTypeMenu_pushButton->hide();
1017 ui->sectionButtons_widget->show();
1018 ui->messageTypeButtons_widget->show();
1019 }
1020 } else {
1021 // Compact layout
1022 ui->sectionMenu_pushButton->setVisible(!_sections.empty());
1023 ui->messageTypeMenu_pushButton->setVisible(!_messageTypeVisible.empty());
1024 ui->sectionButtons_widget->hide();
1025 ui->messageTypeButtons_widget->hide();
1026 }
1027}
1028
1029QTextCursor OutputWidget::nextInsertAt() const
1030{

Callers

nothing calls this directly

Calls 2

widthMethod · 0.45
sizeHintMethod · 0.45

Tested by

no test coverage detected