git-svn-id: svn://db.shs.com.ru/libs@275 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -356,7 +356,7 @@ void BlockBusItem::checkDelete() {
|
||||
|
||||
|
||||
void BlockBusItem::emitAction(BlockItemBase::Action a) {
|
||||
QMetaObject::invokeMethod(scene()->views().back(), "actionEvent", Q_ARG(BlockItemBase::Action, a), Q_ARG(QList<QGraphicsItem*>, QList<QGraphicsItem*>() << this));
|
||||
QMetaObject::invokeMethod(scene()->views().back(), "schemeAction", Q_ARG(BlockItemBase::Action, a), Q_ARG(QList<QGraphicsItem*>, QList<QGraphicsItem*>() << this));
|
||||
QMetaObject::invokeMethod(scene()->views().back(), "connectionsChanged");
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ void BlockEditor::loadFile(QString path) {
|
||||
if (f.open(QIODevice::ReadOnly)) {
|
||||
cur_file = path;
|
||||
loadModel(f.readAll());
|
||||
QDir::setCurrent(QFileInfo(path).dir().path());
|
||||
}
|
||||
setWindowTitle(src_title + QString(" - %1").arg(QFileInfo(path).baseName()));
|
||||
}
|
||||
@@ -159,6 +160,19 @@ void BlockEditor::on_actionRemove_items_triggered() {
|
||||
|
||||
|
||||
void BlockEditor::on_buttonSave_clicked() {
|
||||
if (cur_file.isEmpty()) {
|
||||
on_buttonSaveAs_clicked();
|
||||
return;
|
||||
}
|
||||
QFile f(cur_file);
|
||||
if (f.open(QIODevice::WriteOnly)) {
|
||||
f.write(saveModel());
|
||||
//setWindowTitle(src_title + QString(" - %1").arg(QFileInfo(c).baseName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BlockEditor::on_buttonSaveAs_clicked() {
|
||||
QString c = QFileDialog::getSaveFileName(this, "Save block model to file", cur_file, "*.blockmodel");
|
||||
if (!c.isEmpty()) {
|
||||
QFile f(c);
|
||||
|
||||
@@ -34,6 +34,7 @@ private slots:
|
||||
void arrangePins();
|
||||
void on_actionRemove_items_triggered();
|
||||
void on_buttonSave_clicked();
|
||||
void on_buttonSaveAs_clicked();
|
||||
void on_buttonLoad_clicked();
|
||||
void on_buttonClear_clicked();
|
||||
void on_buttonPinAdd_clicked();
|
||||
|
||||
@@ -41,7 +41,16 @@
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
@@ -124,7 +133,16 @@
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -176,7 +194,7 @@
|
||||
<string>Add</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qad_blockview.qrc">
|
||||
<iconset resource="../../utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/list-add.png</normaloff>:/icons/list-add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -187,7 +205,7 @@
|
||||
<string>Clone</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qad_blockview.qrc">
|
||||
<iconset resource="../../utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/edit-copy.png</normaloff>:/icons/edit-copy.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -214,7 +232,7 @@
|
||||
<string>Remove selected</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qad_blockview.qrc">
|
||||
<iconset resource="../../utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/edit-delete.png</normaloff>:/icons/edit-delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -225,7 +243,7 @@
|
||||
<string>Remove all</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qad_blockview.qrc">
|
||||
<iconset resource="../../utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/edit-clear.png</normaloff>:/icons/edit-clear.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -268,7 +286,16 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="layoutProperties">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</layout>
|
||||
@@ -300,10 +327,40 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonSave">
|
||||
<property name="text">
|
||||
<string>Save ...</string>
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qad_blockview.qrc">
|
||||
<iconset resource="../../utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/document-save.png</normaloff>:/icons/document-save.png</iconset>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonSaveAs">
|
||||
<property name="text">
|
||||
<string>Save as ...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/document-save.png</normaloff>:/icons/document-save.png</iconset>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
@@ -360,7 +417,7 @@
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qad_blockview.qrc">
|
||||
<iconset resource="../../utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/edit-clear.png</normaloff>:/icons/edit-clear.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -370,7 +427,7 @@
|
||||
</layout>
|
||||
<action name="actionRemove_items">
|
||||
<property name="icon">
|
||||
<iconset resource="../qad_blockview.qrc">
|
||||
<iconset resource="../../utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/edit-delete.png</normaloff>:/icons/edit-delete.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -394,6 +451,7 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../utils/qad_utils.qrc"/>
|
||||
<include location="../qad_blockview.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
|
||||
Reference in New Issue
Block a user