Tulip  5.2.0
Large graphs analysis and drawing
CoordEditor.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef COORDEDITOR_H
22 #define COORDEDITOR_H
23 
24 #include <QDialog>
25 
26 #include <tulip/Coord.h>
27 #include <tulip/tulipconf.h>
28 
29 namespace Ui {
30 class CoordEditor;
31 }
32 
33 namespace tlp {
34 /**
35 * @brief Simple Coord edition widget.
36 **/
37 class TLP_QT_SCOPE CoordEditor : public QDialog {
38  Q_OBJECT
39  Q_PROPERTY(Coord coord READ coord WRITE setCoord NOTIFY coordChanged)
40 
41  Ui::CoordEditor *ui;
42  Coord currentCoord;
43 
44 public:
45  explicit CoordEditor(QWidget *parent = nullptr, bool editSize = false);
46  ~CoordEditor() override;
47 
48  tlp::Coord coord() const;
49 
50  // redefinition to ensure it is shown in the center of its parent
51  void showEvent(QShowEvent *ev) override;
52 
53 public slots:
54  void setCoord(const tlp::Coord &s);
55  // redefinition to ensure to catch the end of input
56  void done(int r) override;
57 
58 signals:
59  void coordChanged(tlp::Coord coord);
60 
61 private slots:
62  void coordUpdated();
63 };
64 }
65 
66 #endif // COORDEDITOR_H
67 ///@endcond