version 2.17.0
iconedlabel icon size scale in auto scale mode BlockItem decors visibility logic flags
This commit is contained in:
@@ -250,10 +250,8 @@ DrawTools::DrawTools(BlockView * parent)
|
||||
widget_props = new QWidget();
|
||||
ui = new Ui::DrawTools();
|
||||
ui->setupUi(widget_props);
|
||||
ui->labelPen->setMinimumSize(preferredIconSize(1.5, widget_props));
|
||||
ui->labelPen->setMaximumSize(ui->labelPen->minimumSize());
|
||||
ui->labelBrush->setMinimumSize(ui->labelPen->minimumSize());
|
||||
ui->labelBrush->setMaximumSize(ui->labelBrush->minimumSize());
|
||||
ui->labelPen->setIconSizeAutoScale(1.5);
|
||||
ui->labelBrush->setIconSizeAutoScale(1.5);
|
||||
widget_props->setEnabled(false);
|
||||
int fh = qMax<int>(fontHeight(this), 22);
|
||||
int thick = lineThickness(this);
|
||||
@@ -331,6 +329,11 @@ DrawTools::DrawTools(BlockView * parent)
|
||||
connect(ui->actionLeft, SIGNAL(triggered(bool)), this, SLOT(actionLeft_triggered(bool)));
|
||||
connect(ui->actionHCenter, SIGNAL(triggered(bool)), this, SLOT(actionHCenter_triggered(bool)));
|
||||
connect(ui->actionRight, SIGNAL(triggered(bool)), this, SLOT(actionRight_triggered(bool)));
|
||||
connect(ui->groupShowLogic, SIGNAL(toggled(bool)), this, SLOT(decorVisibleLogicChanged()));
|
||||
connect(ui->checkVLEnabled, SIGNAL(toggled(bool)), this, SLOT(decorVisibleLogicChanged()));
|
||||
connect(ui->checkVLHovered, SIGNAL(toggled(bool)), this, SLOT(decorVisibleLogicChanged()));
|
||||
connect(ui->checkVLSelected, SIGNAL(toggled(bool)), this, SLOT(decorVisibleLogicChanged()));
|
||||
connect(ui->checkVLInverse, SIGNAL(toggled(bool)), this, SLOT(decorVisibleLogicChanged()));
|
||||
connect(&font_dlg, SIGNAL(currentFontChanged(QFont)), this, SLOT(propertyChanged()));
|
||||
connect(&size_item, SIGNAL(sizeChanged()), this, SLOT(sizeChanged()));
|
||||
connect(&size_item, SIGNAL(textEditRequest()), this, SLOT(buttonTextEdit_clicked()));
|
||||
@@ -573,9 +576,13 @@ void DrawTools::blockPropSignals(bool block_) {
|
||||
ui->actionHCenter->blockSignals(block_);
|
||||
ui->actionLeft->blockSignals(block_);
|
||||
ui->actionRight->blockSignals(block_);
|
||||
foreach(QToolButton * b, buttons_align) {
|
||||
for (auto * b: buttons_align)
|
||||
b->blockSignals(block_);
|
||||
}
|
||||
ui->groupShowLogic->blockSignals(block_);
|
||||
ui->checkVLEnabled->blockSignals(block_);
|
||||
ui->checkVLHovered->blockSignals(block_);
|
||||
ui->checkVLSelected->blockSignals(block_);
|
||||
ui->checkVLInverse->blockSignals(block_);
|
||||
}
|
||||
|
||||
|
||||
@@ -643,8 +650,9 @@ void DrawTools::selectionChanged() {
|
||||
return;
|
||||
}
|
||||
widget_props->setEnabled(true);
|
||||
cur_item = sil[0];
|
||||
if (!sil.isEmpty()) cur_item = sil[0];
|
||||
if (!cur_item) {
|
||||
ui->groupShowLogic->setEnabled(false);
|
||||
emitZAvailabe();
|
||||
return;
|
||||
}
|
||||
@@ -654,8 +662,10 @@ void DrawTools::selectionChanged() {
|
||||
QGraphicsRectItem * irect = qgraphicsitem_cast<QGraphicsRectItem *>(cur_item);
|
||||
QGraphicsEllipseItem * iell = qgraphicsitem_cast<QGraphicsEllipseItem *>(cur_item);
|
||||
QGraphicsLineItem * iline = qgraphicsitem_cast<QGraphicsLineItem *>(cur_item);
|
||||
bool is_decor = false;
|
||||
blockPropSignals(true);
|
||||
if (itext) {
|
||||
is_decor = true;
|
||||
ui->stackedProperties->setCurrentIndex(0);
|
||||
ui->comboText->setEditText(itext->text());
|
||||
ui->colorButtonPen->setColor(itext->brush().color());
|
||||
@@ -667,6 +677,7 @@ void DrawTools::selectionChanged() {
|
||||
ui->widgetAlign9->setEnabled(false);
|
||||
size_item.assignObject(itext);
|
||||
} else if (iatext) {
|
||||
is_decor = true;
|
||||
ui->stackedProperties->setCurrentIndex(0);
|
||||
ui->comboText->setEditText(iatext->text());
|
||||
ui->colorButtonPen->setColor(iatext->brush().color());
|
||||
@@ -717,11 +728,13 @@ void DrawTools::selectionChanged() {
|
||||
ui->widgetAlign9->setEnabled(true);
|
||||
size_item.assignObject(iatext);
|
||||
} else if (ipixmap) {
|
||||
is_decor = true;
|
||||
ui->stackedProperties->setCurrentIndex(2);
|
||||
ui->spinScale->setValue(sqrt(ipixmap->transform().determinant()));
|
||||
setToolButtonsEnabled(false, false, false);
|
||||
size_item.assignObject(ipixmap);
|
||||
} else if (irect || iell) {
|
||||
is_decor = true;
|
||||
ui->stackedProperties->setCurrentIndex(1);
|
||||
QAbstractGraphicsShapeItem * ishape = nullptr;
|
||||
if (irect) {
|
||||
@@ -743,6 +756,7 @@ void DrawTools::selectionChanged() {
|
||||
if (resize_enabled) size_item.assignObject(ishape);
|
||||
}
|
||||
} else if (iline) {
|
||||
is_decor = true;
|
||||
ui->stackedProperties->setCurrentIndex(1);
|
||||
ui->colorButtonPen->setColor(iline->pen().color());
|
||||
ui->spinThick->setValue(iline->pen().widthF());
|
||||
@@ -753,6 +767,15 @@ void DrawTools::selectionChanged() {
|
||||
ui->stackedProperties->setCurrentIndex(3);
|
||||
widget_props->setEnabled(false);
|
||||
}
|
||||
ui->groupShowLogic->setEnabled(is_decor);
|
||||
if (is_decor) {
|
||||
BlockviewDecorShowLogics slf(cur_item->data(bvidDecorShowLogic).toUInt());
|
||||
ui->groupShowLogic->setChecked(slf != bvdslAlways);
|
||||
ui->checkVLEnabled->setChecked(slf.testFlag(bvdslEnabled));
|
||||
ui->checkVLHovered->setChecked(slf.testFlag(bvdslHovered));
|
||||
ui->checkVLSelected->setChecked(slf.testFlag(bvdslSelected));
|
||||
ui->checkVLInverse->setChecked(slf.testFlag(bvdslInverse));
|
||||
}
|
||||
emitZAvailabe(cur_item);
|
||||
blockPropSignals(false);
|
||||
}
|
||||
@@ -855,6 +878,19 @@ void DrawTools::comboLineStyleChanged() {
|
||||
}
|
||||
|
||||
|
||||
void DrawTools::decorVisibleLogicChanged() {
|
||||
if (!cur_item) return;
|
||||
uint f = 0;
|
||||
if (ui->groupShowLogic->isChecked()) {
|
||||
if (ui->checkVLEnabled->isChecked()) f |= bvdslEnabled;
|
||||
if (ui->checkVLHovered->isChecked()) f |= bvdslHovered;
|
||||
if (ui->checkVLSelected->isChecked()) f |= bvdslSelected;
|
||||
if (ui->checkVLInverse->isChecked()) f |= bvdslInverse;
|
||||
}
|
||||
cur_item->setData(bvidDecorShowLogic, f);
|
||||
}
|
||||
|
||||
|
||||
void DrawTools::buttonImage_clicked() {
|
||||
QGraphicsPixmapItem * pi = qgraphicsitem_cast<QGraphicsPixmapItem *>(cur_item);
|
||||
if (!pi) return;
|
||||
|
||||
Reference in New Issue
Block a user