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

Improve central widget handling #225

Closed
narnaud opened this issue Aug 13, 2021 · 5 comments
Closed

Improve central widget handling #225

narnaud opened this issue Aug 13, 2021 · 5 comments

Comments

@narnaud
Copy link
Member

narnaud commented Aug 13, 2021

Right now, the central widget (like in QApplication) is a DockWidget, and it's not entirely obvious how the API should be use:

auto mainWindow = new KDDockWidgets::MainWindow("MainWindow", KDDockWidgets::MainWindowOption_HasCentralFrame, );
auto centralWidget = new KDDockWidgets::DockWidget("Sketchup_CentralWidget");
auto widget = new MyCentralWidget;
centralWidget->setWidget(widget);
addDockWidgetAsTab(centralWidget);

At this point, it shows the central widget with a tabBar, so one has to do something like this to hide it:

centralWidget->findChildren<QTabBar*>().first()->hide();

API issue: it would be nice to have a simpler API, like there is one in QApplication (hiding the fact that you need to create a KDDockWidget).

Also, it would be nice to have a bit more choices on the mainwindow type, I can see 4 as now:

  • NoFrame
  • CentralWidget (not showing any tab bars, as there's only one widget)
  • TabBar
  • MDI

IMO you can't remove the tabBar if there's only one widget, as it may be needed, that's why I'm thinking of a new mode.

@iamsergio
Copy link
Contributor

The goal of "Central Widget" is to have "central document mode", like you'll see in IDEs, there you also can't remove the tabbar.

I guess you don't want your central widget to be detachable ?

@narnaud
Copy link
Member Author

narnaud commented Aug 27, 2021

No, there's only one widget. I would like something close to QMainWindow::setCentralWidget.

@iamsergio
Copy link
Contributor

Ok, that's doable.
However it can be weird if you dock a lot of stuff on the left, then your central widget isn't exactly in the "center".
This is more of a conceptual problem though, which is expected

@narnaud
Copy link
Member Author

narnaud commented Aug 27, 2021

Think about it more as "this is my main widget/view" rather than "this is my central widget/view", and the rest is docks around (left/right/top/bottom).
Of course there could be docks only on the left, but the view still remain the main view, the one the user is interacting the most with.

@iamsergio
Copy link
Contributor

makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants