Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
c0344c6d
Commit
c0344c6d
authored
16 years ago
by
hjk
Browse files
Options
Downloads
Patches
Plain Diff
Fixes: make "Hello World" plugin compilabe
RevBy: con make "Hello World" plugin compilabe
parent
b904780f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/helloworld/helloworldplugin.cpp
+16
-29
16 additions, 29 deletions
src/plugins/helloworld/helloworldplugin.cpp
with
16 additions
and
29 deletions
src/plugins/helloworld/helloworldplugin.cpp
+
16
−
29
View file @
c0344c6d
...
...
@@ -33,26 +33,21 @@
#include
"helloworldplugin.h"
#include
"helloworldwindow.h"
#include
<coreplugin/modemanager.h>
#include
<coreplugin/actionmanager/actionmanagerinterface.h>
#include
<extensionsystem/pluginmanager.h>
#include
<coreplugin/icore.h>
#include
<coreplugin/basemode.h>
#include
<coreplugin/coreconstants.h>
#include
<coreplugin/icore.h>
#include
<coreplugin/modemanager.h>
#include
<coreplugin/uniqueidmanager.h>
#include
<extensionsystem/pluginmanager.h>
#include
<QtCore/QDebug>
#include
<QtCore/
qp
lugin
.h
>
#include
<QtCore/
QtP
lugin>
#include
<QtGui/QAction>
#include
<QtGui/QMenu>
#include
<QtGui/QMessageBox>
#include
<QtGui/QPushButton>
#include
<coreplugin/CoreTools>
#include
"helloworldplugin.h"
using
namespace
HelloWorld
::
Internal
;
/*! Constructs the Hello World plugin. Normally plugins don't do anything in
...
...
@@ -77,30 +72,20 @@ HelloWorldPlugin::~HelloWorldPlugin()
\a error_message can be used to pass an error message to the plugin system,
if there was any.
*/
bool
HelloWorldPlugin
::
initialize
(
const
QStringList
&
/*
arguments
*/
,
QString
*
error_message
)
bool
HelloWorldPlugin
::
initialize
(
const
QStringList
&
arguments
,
QString
*
error_message
)
{
Q_UNUSED
(
arguments
)
Q_UNUSED
(
error_message
)
// Get the primary access point to the workbench.
Core
::
ICore
*
core
=
ExtensionSystem
::
PluginManager
::
instance
()
->
getObject
<
Core
::
ICore
>
();
// Create our own widget that we want to show in a view in the IDE.
HelloWorldWindow
*
window
=
new
HelloWorldWindow
;
// Create a unique context id for our own view, that will be used for the
// menu entry later.
QList
<
int
>
context
=
QList
<
int
>
()
<<
core
->
uniqueIDManager
()
->
uniqueIdentifier
(
QLatin1String
(
"HelloWorld.MainView"
));
// Create a new view that contains our widget and register it with the
// plugin manager. The view will have the id "HelloWorld.HelloWorldWindow",
// and if it has focus it provides 'context' to the context list in
// Qt Creator. It will be put into the right dock widget area.
addAutoReleasedObject
(
new
Core
::
BaseView
(
"HelloWorld.HelloWorldWindow"
,
window
,
context
,
Qt
::
RightDockWidgetArea
));
// Create an action to be triggered by a menu entry
QAction
*
helloWorldAction
=
new
QAction
(
"Say
\"
&Hello World!
\"
"
,
this
);
connect
(
helloWorldAction
,
SIGNAL
(
triggered
()),
SLOT
(
sayHelloWorld
()));
...
...
@@ -126,13 +111,15 @@ bool HelloWorldPlugin::initialize(const QStringList & /*arguments*/, QString *er
actionManager
->
actionContainer
(
Core
::
Constants
::
M_TOOLS
);
toolsMenu
->
addMenu
(
helloWorldMenu
);
// Add a mode with a push button based on BaseMode. Like the BaseView, it will unregister
// itself from the plugin manager when it is deleted.
addAutoReleasedObject
(
new
Core
::
BaseMode
(
tr
(
"Hello world!"
),
"HelloWorld.HelloWorldMode"
,
QIcon
(),
0
,
// priority
new
QPushButton
(
tr
(
"Hello World PushButton!"
))));
// Add a mode with a push button based on BaseMode. Like the BaseView,
// it will unregister itself from the plugin manager when it is deleted.
Core
::
BaseMode
*
baseMode
=
new
Core
::
BaseMode
;
baseMode
->
setUniqueModeName
(
"HelloWorld.HelloWorldMode"
);
baseMode
->
setName
(
tr
(
"Hello world!"
));
baseMode
->
setIcon
(
QIcon
());
baseMode
->
setPriority
(
0
);
baseMode
->
setWidget
(
new
QPushButton
(
tr
(
"Hello World PushButton!"
)));
addAutoReleasedObject
(
baseMode
);
// Add the Hello World action command to the mode manager (with 0 priority)
Core
::
ModeManager
*
modeManager
=
core
->
modeManager
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment