mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Better positioning of the plus sign icons in the Equip. tab
There are a couple of problems with said icons: - When the Equip. tab is first seen, no relative event is monitored so that the correct position is updated and the icons are positioned. To solve that we connect the signal MainTab::currentChanged(int) and call MainTab::equipmentPlusUpdate(). - When the info-profile QSplitter resizes with a snap towards/from the edges of the main window, no resize handler is called such as MainTab::resizeEvent(). A solution is to monitor the resize of the info-profile splitter with MainWindow::on_infoProfileSplitter_splitterMoved() and again call MainTab::equipmentPlusUpdate() Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
937fef819a
commit
8678e2d57c
4 changed files with 30 additions and 8 deletions
|
@ -90,28 +90,39 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
|
|||
ui->weights->horizontalHeader()->setResizeMode (WeightModel::REMOVE , QHeaderView::Fixed);
|
||||
ui->weights->verticalHeader()->setDefaultSectionSize( metrics.height() +8 );
|
||||
ui->weights->setItemDelegateForColumn(WeightModel::TYPE, new WSInfoDelegate());
|
||||
|
||||
connect(this, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
|
||||
initialUiSetup();
|
||||
}
|
||||
|
||||
// We need to manually position the 'plus' on cylinder and weight.
|
||||
void MainTab::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
if (ui->cylindersGroup->isVisible())
|
||||
addCylinder->setGeometry(ui->cylindersGroup->contentsRect().width() - 30, 2, 24,24);
|
||||
|
||||
if (ui->weightGroup->isVisible())
|
||||
addWeight->setGeometry(ui->weightGroup->contentsRect().width() - 30, 2, 24,24);
|
||||
|
||||
equipmentPlusUpdate();
|
||||
QTabWidget::resizeEvent(event);
|
||||
}
|
||||
|
||||
void MainTab::showEvent(QShowEvent* event)
|
||||
{
|
||||
QTabWidget::showEvent(event);
|
||||
addCylinder->setGeometry(ui->cylindersGroup->contentsRect().width() - 30, 2, 24,24);
|
||||
addWeight->setGeometry(ui->weightGroup->contentsRect().width() - 30, 2, 24,24);
|
||||
equipmentPlusUpdate();
|
||||
}
|
||||
|
||||
void MainTab::tabChanged(int idx)
|
||||
{
|
||||
/* if the current tab has become of index 1 (i.e. the equipment tab) call update
|
||||
* for the plus signs */
|
||||
if (idx == 1)
|
||||
equipmentPlusUpdate();
|
||||
}
|
||||
|
||||
void MainTab::equipmentPlusUpdate()
|
||||
{
|
||||
if (ui->cylindersGroup->isVisible())
|
||||
addCylinder->setGeometry(ui->cylindersGroup->contentsRect().width() - 30, 2, 24,24);
|
||||
if (ui->weightGroup->isVisible())
|
||||
addWeight->setGeometry(ui->weightGroup->contentsRect().width() - 30, 2, 24,24);
|
||||
}
|
||||
|
||||
bool MainTab::eventFilter(QObject* object, QEvent* event)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue