Engauge Digitizer  2
DlgSettingsSegments.h
1 #ifndef DLG_SETTINGS_SEGMENTS_H
2 #define DLG_SETTINGS_SEGMENTS_H
3 
4 #include "DlgSettingsAbstractBase.h"
5 #include "GraphicsPoint.h"
6 #include <QImage>
7 #include <QList>
8 
10 class QCheckBox;
11 class QComboBox;
12 class QGridLayout;
13 class QGraphicsScene;
14 class QSpinBox;
15 class Segment;
16 class ViewPreview;
17 
18 typedef QList<GraphicsPoint*> GraphicsPoints;
19 
22 {
23  Q_OBJECT;
24 
25 public:
28  virtual ~DlgSettingsSegments();
29 
30  virtual QWidget *createSubPanel ();
31  virtual void load (CmdMediator &cmdMediator);
32 
33 private slots:
34  void slotFillCorners (int state);
35  void slotLineColor (const QString &);
36  void slotLineWidth (int);
37  void slotMinLength (const QString &);
38  void slotPointSeparation (const QString &);
39 
40 protected:
41  virtual void handleOk ();
42 
43 private:
44 
45  void clearPoints();
46  void createControls (QGridLayout *layout, int &row);
47  void createPreview (QGridLayout *layout, int &row);
48  QImage createPreviewImage () const;
49  void updateControls();
50  void updatePreview();
51 
52  QSpinBox *m_spinMinLength;
53  QSpinBox *m_spinPointSeparation;
54  QCheckBox *m_chkFillCorners;
55  QSpinBox *m_spinLineWidth;
56  QComboBox *m_cmbLineColor;
57 
58  QGraphicsScene *m_scenePreview;
59  ViewPreview *m_viewPreview;
60 
61  DocumentModelSegments *m_modelSegmentsBefore;
62  DocumentModelSegments *m_modelSegmentsAfter;
63 
64  QList<Segment*> m_segments; // Segments extracted from image
65  GraphicsPoints m_points; // Points spread along the segments
66 
67  bool m_loading; // Flag that prevents multiple preview updates during loading while controls get loaded
68 };
69 
70 #endif // DLG_SETTINGS_SEGMENTS_H
Dialog for editing Segments settings, for DigitizeStateSegment.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Class that modifies QGraphicsView to automatically expand/shrink the view to fit the window...
Definition: ViewPreview.h:8
Selectable piecewise-defined line that follows a filtered line in the image.
Definition: Segment.h:15
Command queue stack.
Definition: CmdMediator.h:16
DlgSettingsSegments(MainWindow &mainWindow)
Single constructor.
Model for DlgSettingsSegments and CmdSettingsSegments.
Abstract base class for all Settings dialogs.
virtual void handleOk()
Process slotOk.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
MainWindow & mainWindow()
Get method for MainWindow.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition: MainWindow.h:60
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.