summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJarek Kobus <jkobus@trolltech.com>2010-04-13 13:15:49 (GMT)
committerJarek Kobus <jkobus@trolltech.com>2010-04-13 13:15:49 (GMT)
commit24eec1960e0dc3594bd8ff77a8f329207a669056 (patch)
treec203f645416356329b3d1ff1dfbd255c4e31ceb6 /tools
parent6f736694461edc25b6e757f40ab9cad6a9207ad4 (diff)
downloadQt-24eec1960e0dc3594bd8ff77a8f329207a669056.zip
Qt-24eec1960e0dc3594bd8ff77a8f329207a669056.tar.gz
Qt-24eec1960e0dc3594bd8ff77a8f329207a669056.tar.bz2
Use unifiedToolBarOnMac, by default don't show some tool action.
Some tool actions are hidden by default (undo/redo, cut.copy.paste), the user can bring them back by using View|Toolbars|Configure Toolbars dialog. Reviewed-by: Jens Bache-Wiig <jbache@trolltech.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Daniel Molkentin <daniel.molkentin@nokia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/designer/src/designer/mainwindow.cpp20
-rw-r--r--tools/designer/src/designer/qdesigner_actions.cpp19
-rw-r--r--tools/designer/src/designer/qdesigner_actions.h4
-rw-r--r--tools/designer/src/designer/qdesigner_workbench.cpp1
4 files changed, 43 insertions, 1 deletions
diff --git a/tools/designer/src/designer/mainwindow.cpp b/tools/designer/src/designer/mainwindow.cpp
index c27e2b4..86bc47e 100644
--- a/tools/designer/src/designer/mainwindow.cpp
+++ b/tools/designer/src/designer/mainwindow.cpp
@@ -75,7 +75,7 @@ static void addActionsToToolBar(const ActionList &actions, QToolBar *t)
const ActionList::const_iterator cend = actions.constEnd();
for (ActionList::const_iterator it = actions.constBegin(); it != cend; ++it) {
QAction *action = *it;
- if (!action->icon().isNull())
+ if (action->property(QDesignerActions::defaultToolbarPropertyName).toBool())
t->addAction(action);
}
}
@@ -113,6 +113,8 @@ void MainWindowBase::closeEvent(QCloseEvent *e)
QList<QToolBar *> MainWindowBase::createToolBars(const QDesignerActions *actions, bool singleToolBar)
{
+ // Note that whenever you want to add a new tool bar here, you also have to update the default
+ // action groups added to the toolbar manager in the mainwindow constructor
QList<QToolBar *> rc;
if (singleToolBar) {
//: Not currently used (main tool bar)
@@ -252,6 +254,22 @@ ToolBarManager::ToolBarManager(QMainWindow *configureableMainWindow,
m_manager->addAction(action, dockTitle);
}
+ QString category(tr("File"));
+ foreach(QAction *action, actions->fileActions()->actions())
+ m_manager->addAction(action, category);
+
+ category = tr("Edit");
+ foreach(QAction *action, actions->editActions()->actions())
+ m_manager->addAction(action, category);
+
+ category = tr("Tools");
+ foreach(QAction *action, actions->toolActions()->actions())
+ m_manager->addAction(action, category);
+
+ category = tr("Form");
+ foreach(QAction *action, actions->formActions()->actions())
+ m_manager->addAction(action, category);
+
m_manager->addAction(m_configureAction, tr("Toolbars"));
updateToolBarMenu();
}
diff --git a/tools/designer/src/designer/qdesigner_actions.cpp b/tools/designer/src/designer/qdesigner_actions.cpp
index 6776351..a593a76 100644
--- a/tools/designer/src/designer/qdesigner_actions.cpp
+++ b/tools/designer/src/designer/qdesigner_actions.cpp
@@ -107,6 +107,8 @@ QT_BEGIN_NAMESPACE
using namespace qdesigner_internal;
+const char *QDesignerActions::defaultToolbarPropertyName = "__qt_defaultToolBarAction";
+
//#ifdef Q_WS_MAC
# define NONMODAL_PREVIEW
//#endif
@@ -236,6 +238,10 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_helpActions = createHelpActions();
+ m_newFormAction->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ m_openFormAction->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ m_saveFormAction->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+
QDesignerFormWindowManagerInterface *formWindowManager = m_core->formWindowManager();
Q_ASSERT(formWindowManager != 0);
@@ -322,6 +328,9 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_editActions->addAction(formWindowManager->actionLower());
m_editActions->addAction(formWindowManager->actionRaise());
+ formWindowManager->actionLower()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionRaise()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+
//
// edit mode actions
//
@@ -349,6 +358,7 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
if (QDesignerFormEditorPluginInterface *formEditorPlugin = qobject_cast<QDesignerFormEditorPluginInterface*>(plugin)) {
if (QAction *action = formEditorPlugin->action()) {
m_toolActions->addAction(action);
+ action->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
action->setCheckable(true);
}
}
@@ -376,6 +386,15 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_formActions->addAction(formWindowManager->actionSimplifyLayout());
m_formActions->addAction(createSeparator(this));
+ formWindowManager->actionHorizontalLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionVerticalLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionSplitHorizontal()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionSplitVertical()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionGridLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionFormLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionBreakLayout()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+ formWindowManager->actionAdjustSize()->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
+
m_previewFormAction->setShortcut(tr("CTRL+R"));
m_formActions->addAction(m_previewFormAction);
connect(m_previewManager, SIGNAL(firstPreviewOpened()), this, SLOT(updateCloseAction()));
diff --git a/tools/designer/src/designer/qdesigner_actions.h b/tools/designer/src/designer/qdesigner_actions.h
index 9dfcef1..d8f9e42 100644
--- a/tools/designer/src/designer/qdesigner_actions.h
+++ b/tools/designer/src/designer/qdesigner_actions.h
@@ -113,6 +113,10 @@ public:
QString uiExtension() const;
+ // Boolean dynamic property set on actions to
+ // show them in the default toolbar layout
+ static const char *defaultToolbarPropertyName;
+
public slots:
void activeFormWindowChanged(QDesignerFormWindowInterface *formWindow);
void createForm();
diff --git a/tools/designer/src/designer/qdesigner_workbench.cpp b/tools/designer/src/designer/qdesigner_workbench.cpp
index b65ce7e..168c468 100644
--- a/tools/designer/src/designer/qdesigner_workbench.cpp
+++ b/tools/designer/src/designer/qdesigner_workbench.cpp
@@ -419,6 +419,7 @@ void QDesignerWorkbench::switchToDockedMode()
m_mode = DockedMode;
const QDesignerSettings settings(m_core);
m_dockedMainWindow = new DockedMainWindow(this, m_toolbarMenu, m_toolWindows);
+ m_dockedMainWindow->setUnifiedTitleAndToolBarOnMac(true);
m_dockedMainWindow->setCloseEventPolicy(MainWindowBase::EmitCloseEventSignal);
connect(m_dockedMainWindow, SIGNAL(closeEventReceived(QCloseEvent*)), this, SLOT(handleCloseEvent(QCloseEvent*)));
connect(m_dockedMainWindow, SIGNAL(fileDropped(QString)), this, SLOT(slotFileDropped(QString)));