Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to allow to change to quad view at runtime #17

Merged
merged 2 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
.DS_Store
.DS_Store?

.vscode
.clang-format
29 changes: 22 additions & 7 deletions include/qtcad/QtCADQuad.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class QTCAD_EXPORT QtCADQuad : public QWidget
Q_OBJECT

public:
explicit QtCADQuad(QWidget *parent = nullptr, int type = QtCADView_AUTO);
explicit QtCADQuad(QWidget *parent, struct ged *gedpRef, int type);
~QtCADQuad();

void stash_hashes(); // Store current dmp and v hash values
Expand All @@ -58,12 +58,9 @@ class QTCAD_EXPORT QtCADQuad : public QWidget
void select(int quadrant_num);
void select(const char *id); // valid inputs: ur, ul, ll and lr

QtCADView *ur = NULL; // Quadrant 1
QtCADView *ul = NULL; // Quadrant 2
QtCADView *ll = NULL; // Quadrant 3
QtCADView *lr = NULL; // Quadrant 4

QtCADView *c = NULL;
void changeToSingleFrame();
void changeToQuadFrame();
void changeToResizeableQuadFrame();

signals:
void changed();
Expand All @@ -75,6 +72,24 @@ class QTCAD_EXPORT QtCADQuad : public QWidget

private:
bool eventFilter(QObject*, QEvent*);
QtCADView *createView(int index);
QGridLayout *createLayout();

int graphicsType = QtCADView_SW;
// Holds up to 4 views in single view only the first view is constructed
// The other views are constructed if quad view mode is selected by the user
QtCADView *views[4] = {nullptr, nullptr, nullptr, nullptr};
QtCADView *currentView;
// We need to hang on to this because we don't create the other quad views until the user switches mode
struct ged *gedp;

// Hang on to thiese pointers so when we need to clean up memory we have them
QGridLayout *currentLayout = nullptr;
QSpacerItem *spacerTop = nullptr;
QSpacerItem *spacerBottom = nullptr;
QSpacerItem *spacerLeft = nullptr;
QSpacerItem *spacerRight = nullptr;
QSpacerItem *spacerCenter = nullptr;
};

#endif /* QTCADQUAD_H */
Expand Down
Loading