Show paper preview in list.
--HG-- branch : feature
This commit is contained in:
parent
c84caa349d
commit
0b85380f20
|
@ -44,6 +44,8 @@ DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
|
||||||
SCASSERT(bCancel != nullptr);
|
SCASSERT(bCancel != nullptr);
|
||||||
connect(bCancel, &QPushButton::clicked, this, &DialogLayoutProgress::StopWorking);
|
connect(bCancel, &QPushButton::clicked, this, &DialogLayoutProgress::StopWorking);
|
||||||
setModal(true);
|
setModal(true);
|
||||||
|
|
||||||
|
this->setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -13,6 +13,18 @@
|
||||||
<height>119</height>
|
<height>119</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>566</width>
|
||||||
|
<height>119</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>566</width>
|
||||||
|
<height>119</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Creation a layout</string>
|
<string>Creation a layout</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -260,6 +260,7 @@ void TableWindow::ShowPaper(int index)
|
||||||
if (index < 0 || index > scenes.size())
|
if (index < 0 || index > scenes.size())
|
||||||
{
|
{
|
||||||
ui->view->setScene(tempScene);
|
ui->view->setScene(tempScene);
|
||||||
|
ui->actionSave->setEnabled(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -518,15 +519,43 @@ void TableWindow::CreateScenes()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::PrepareSceneList()
|
void TableWindow::PrepareSceneList()
|
||||||
{
|
{
|
||||||
const QIcon ico("://icon/64x64/icon64x64.png");
|
|
||||||
for (int i=1; i<=scenes.size(); ++i)
|
for (int i=1; i<=scenes.size(); ++i)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = new QListWidgetItem(ico, QString::number(i));
|
QListWidgetItem *item = new QListWidgetItem(ScenePreview(i-1), QString::number(i));
|
||||||
ui->listWidget->addItem(item);
|
ui->listWidget->addItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scenes.isEmpty() == false)
|
if (scenes.isEmpty() == false)
|
||||||
{
|
{
|
||||||
ui->listWidget->setCurrentRow(0);
|
ui->listWidget->setCurrentRow(0);
|
||||||
|
ui->actionSave->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QIcon TableWindow::ScenePreview(int i) const
|
||||||
|
{
|
||||||
|
QImage image;
|
||||||
|
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||||
|
if (paper)
|
||||||
|
{
|
||||||
|
const QRectF r = paper->rect();
|
||||||
|
// Create the image with the exact size of the shrunk scene
|
||||||
|
image = QImage(QSize(static_cast<qint32>(r.width()), static_cast<qint32>(r.height())), QImage::Format_RGB32);
|
||||||
|
image.fill(Qt::white);
|
||||||
|
QPainter painter(&image);
|
||||||
|
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||||
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
|
painter.setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()), Qt::SolidLine, Qt::RoundCap,
|
||||||
|
Qt::RoundJoin));
|
||||||
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
|
scenes.at(i)->render(&painter);
|
||||||
|
image.scaled(101, 146, Qt::KeepAspectRatio);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
image = QImage(QSize(101, 146), QImage::Format_RGB32);
|
||||||
|
image.fill(Qt::white);
|
||||||
|
}
|
||||||
|
return QIcon(QBitmap::fromImage(image));
|
||||||
|
}
|
||||||
|
|
|
@ -101,6 +101,7 @@ private:
|
||||||
void CreateShadows();
|
void CreateShadows();
|
||||||
void CreateScenes();
|
void CreateScenes();
|
||||||
void PrepareSceneList();
|
void PrepareSceneList();
|
||||||
|
QIcon ScenePreview(int i) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TABLEWINDOW_H
|
#endif // TABLEWINDOW_H
|
||||||
|
|
|
@ -23,7 +23,17 @@
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="VTableGraphicsView" name="view"/>
|
<widget class="VTableGraphicsView" name="view">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>20</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="resizeAnchor">
|
||||||
|
<enum>QGraphicsView::AnchorUnderMouse</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -33,8 +43,8 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16</width>
|
<width>24</width>
|
||||||
<height>16</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolButtonStyle">
|
<property name="toolButtonStyle">
|
||||||
|
@ -47,11 +57,6 @@
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
<addaction name="actionSave"/>
|
<addaction name="actionSave"/>
|
||||||
<addaction name="actionNext"/>
|
|
||||||
<addaction name="actionTurn"/>
|
|
||||||
<addaction name="actionAdd"/>
|
|
||||||
<addaction name="actionRemove"/>
|
|
||||||
<addaction name="actionMirror"/>
|
|
||||||
<addaction name="actionZoomIn"/>
|
<addaction name="actionZoomIn"/>
|
||||||
<addaction name="actionZoomOut"/>
|
<addaction name="actionZoomOut"/>
|
||||||
<addaction name="actionStop"/>
|
<addaction name="actionStop"/>
|
||||||
|
@ -59,6 +64,24 @@
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
<widget class="QDockWidget" name="dockWidget">
|
<widget class="QDockWidget" name="dockWidget">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>187</width>
|
||||||
|
<height>121</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>187</width>
|
||||||
|
<height>524287</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="features">
|
<property name="features">
|
||||||
<set>QDockWidget::DockWidgetMovable</set>
|
<set>QDockWidget::DockWidgetMovable</set>
|
||||||
</property>
|
</property>
|
||||||
|
@ -66,7 +89,7 @@
|
||||||
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
|
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Pages</string>
|
<string>Layout pages</string>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="dockWidgetArea">
|
<attribute name="dockWidgetArea">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
|
@ -75,6 +98,18 @@
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="listWidget">
|
<widget class="QListWidget" name="listWidget">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>200</width>
|
<width>200</width>
|
||||||
|
@ -114,35 +149,6 @@
|
||||||
<string>Save layout</string>
|
<string>Save layout</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionNext">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="go-next">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Next</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Next detail</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionTurn">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="object-rotate-left">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Turn</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Turn the detail 90 degrees</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionStop">
|
<action name="actionStop">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="process-stop">
|
<iconset theme="process-stop">
|
||||||
|
@ -156,50 +162,6 @@
|
||||||
<string>Stop laying</string>
|
<string>Stop laying</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionAdd">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="list-add">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Enlarge letter</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Enlarge the length of the sheet</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionRemove">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="list-remove">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Reduce sheet</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Reduce the length of the sheet</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionMirror">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="share/resources/icon.qrc">
|
|
||||||
<normaloff>:/icon/16x16/mirror.png</normaloff>:/icon/16x16/mirror.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Mirroring</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Mirroring</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionZoomIn">
|
<action name="actionZoomIn">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="zoom-in">
|
<iconset theme="zoom-in">
|
||||||
|
@ -227,6 +189,10 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionLayout">
|
<action name="actionLayout">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/32x32/layout.png</normaloff>:/icon/32x32/layout.png</iconset>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Layout</string>
|
<string>Layout</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user