Rework on the Equipment tab to make it look more Modern.

Note that this is a WIP and it does break functionality
- ie, not possible to add Equipments, but this will be
fixed in the next commit. Removed add / edit / remove
buttons, only a single '+' icon appears on the widget
now. the edit / delete will be done in place.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-05-22 09:17:18 -03:00
parent 003729bde6
commit df57b657fd
5 changed files with 69 additions and 146 deletions

View file

@ -61,8 +61,38 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
if (label)
label->setAlignment(Qt::AlignHCenter);
}
/*Thid couldn't be done on the ui file because element
is floating, instead of being fixed on the layout. */
QIcon plusIcon(":plus");
addCylinder = new QPushButton(plusIcon, QString(), ui->cylindersGroup);
addCylinder->setFlat(true);
addCylinder->setToolTip(tr("Add Cylinder"));
addWeight = new QPushButton(plusIcon, QString(), ui->weightGroup);
addWeight->setFlat(true);
addWeight->setToolTip(tr("Add Weight System"));
}
// 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);
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);
}
bool MainTab::eventFilter(QObject* object, QEvent* event)
{
if (event->type() == QEvent::FocusIn) {