⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 propertiesdialog.ui.h

📁 qt3.8开发的例子, 做linux下qt编程可以参考
💻 H
字号:
#include <qcolordialog.h>#include "diagramview.h"void PropertiesDialog::chooseLineColor(){    QColor oldColor = lineColorSample->paletteBackgroundColor();    QColor newColor = QColorDialog::getColor(oldColor, this);    if (newColor.isValid())        lineColorSample->setPaletteBackgroundColor(newColor);}void PropertiesDialog::chooseFillColor(){    QColor oldColor = fillColorSample->paletteBackgroundColor();    QColor newColor = QColorDialog::getColor(oldColor, this);    if (newColor.isValid())        fillColorSample->setPaletteBackgroundColor(newColor);}void PropertiesDialog::exec(QCanvasItem *item){    if (item->rtti() == DiagramBox::RTTI) {        DiagramBox *box = (DiagramBox *)item;        QRect rect = box->rect();        setCaption(tr("Properties for Box"));        xSpinBox->setValue(rect.x());        ySpinBox->setValue(rect.y());        widthSpinBox->setValue(rect.width());        heightSpinBox->setValue(rect.height());        lineGeometryGroupBox->hide();        textLineEdit->setText(box->text());        lineColorSample->setPaletteBackgroundColor(                box->pen().color());        fillColorSample->setPaletteBackgroundColor(                box->brush().color());    } else if (item->rtti() == DiagramLine::RTTI) {        DiagramLine *line = (DiagramLine *)item;        QPoint start = line->startPoint() + line->offset();        QPoint end = line->endPoint() + line->offset();        setCaption(tr("Properties for Line"));        rectGeometryGroupBox->hide();        x1SpinBox->setValue(start.x());        y1SpinBox->setValue(start.y());        x2SpinBox->setValue(end.x());        y2SpinBox->setValue(end.y());        textLabel->hide();        textLineEdit->hide();        lineColorSample->setPaletteBackgroundColor(                line->pen().color());        fillColorLabel->hide();        fillColorSample->hide();        fillColorButton->hide();    }    if (QDialog::exec()) {        if (item->rtti() == DiagramBox::RTTI) {            DiagramBox *box = (DiagramBox *)item;            box->move(xSpinBox->value(), ySpinBox->value());            box->setSize(widthSpinBox->value(),                         heightSpinBox->value());            box->setText(textLineEdit->text());            box->setPen(lineColorSample->paletteBackgroundColor());            box->setBrush(fillColorSample->paletteBackgroundColor());        } else if (item->rtti() == DiagramLine::RTTI) {            DiagramLine *line = (DiagramLine *)item;            line->move(0, 0);            line->setPoints(x1SpinBox->value(), y1SpinBox->value(),                            x2SpinBox->value(), y2SpinBox->value());            line->setPen(lineColorSample->paletteBackgroundColor());            line->setBrush(fillColorSample->paletteBackgroundColor());        }        item->canvas()->update();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -