Skip to content

Commit

Permalink
added automatic title bar orientation for the commandline
Browse files Browse the repository at this point in the history
This moves the title bar to the side when docked at the bottom or top
(to save space).
The title is changed to prevent overlap with the undock / close buttons.
  • Loading branch information
r-a-v-a-s committed Jan 3, 2016
1 parent a0df324 commit aaad9d8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
25 changes: 25 additions & 0 deletions librecad/src/main/qc_applicationwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2877,3 +2877,28 @@ void QC_ApplicationWindow::widgetOptionsDialog()
}
settings.endGroup();
}

/**
* This slot modifies the commandline's title bar
* depending on the dock area it is moved to.
*/
void QC_ApplicationWindow::modifyCommandTitleBar(Qt::DockWidgetArea area)
{
QDockWidget* cmd_dockwidget = findChild<QDockWidget*>("command_dockwidget");

if (area == Qt::BottomDockWidgetArea || area == Qt::TopDockWidgetArea)
{
cmd_dockwidget->setWindowTitle("Cmd");
cmd_dockwidget->setFeatures(QDockWidget::DockWidgetClosable
|QDockWidget::DockWidgetMovable
|QDockWidget::DockWidgetFloatable
|QDockWidget::DockWidgetVerticalTitleBar);
}
else
{
cmd_dockwidget->setWindowTitle(tr("Command line"));
cmd_dockwidget->setFeatures(QDockWidget::DockWidgetClosable
|QDockWidget::DockWidgetMovable
|QDockWidget::DockWidgetFloatable);
}
}
2 changes: 2 additions & 0 deletions librecad/src/main/qc_applicationwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ public slots:

void widgetOptionsDialog();

void modifyCommandTitleBar(Qt::DockWidgetArea area);

signals:
void gridChanged(bool on);
void draftChanged(bool on);
Expand Down
3 changes: 3 additions & 0 deletions librecad/src/ui/lc_widgetfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ void LC_WidgetFactory::createRightSidebar(QG_ActionHandler* action_handler)
connect(command_widget->leCommand, SIGNAL(escape()), main_window, SLOT(setFocus()));
dock_command->setWidget(command_widget);

connect(dock_command, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)),
main_window, SLOT(modifyCommandTitleBar(Qt::DockWidgetArea)));

main_window->addDockWidget(Qt::RightDockWidgetArea, dock_library);
main_window->tabifyDockWidget(dock_library, dock_block);
main_window->tabifyDockWidget(dock_block, dock_layer);
Expand Down

0 comments on commit aaad9d8

Please sign in to comment.