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
e19c940d
Commit
e19c940d
authored
16 years ago
by
Friedemann Kleint
Browse files
Options
Downloads
Patches
Plain Diff
Fixes: Give a warning when goto slot fails
parent
8f50e94c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/designer/workbenchintegration.cpp
+41
-5
41 additions, 5 deletions
src/plugins/designer/workbenchintegration.cpp
src/plugins/designer/workbenchintegration.h
+4
-0
4 additions, 0 deletions
src/plugins/designer/workbenchintegration.h
with
45 additions
and
5 deletions
src/plugins/designer/workbenchintegration.cpp
+
41
−
5
View file @
e19c940d
...
@@ -53,14 +53,28 @@
...
@@ -53,14 +53,28 @@
#include
<QtDesigner/QDesignerFormWindowInterface>
#include
<QtDesigner/QDesignerFormWindowInterface>
#include
<Qt
Core/QFileInfo
>
#include
<Qt
Gui/QMessageBox
>
#include
<QtCore/QFileInfo>
#include
<QtCore/QDebug>
#include
<QtCore/QDebug>
enum
{
debugSlotNavigation
=
0
};
using
namespace
Designer
::
Internal
;
using
namespace
Designer
::
Internal
;
using
namespace
CPlusPlus
;
using
namespace
CPlusPlus
;
using
namespace
TextEditor
;
using
namespace
TextEditor
;
static
QString
msgClassNotFound
(
const
QString
&
uiClassName
,
const
QList
<
Document
::
Ptr
>
&
docList
)
{
QString
files
;
foreach
(
const
Document
::
Ptr
&
doc
,
docList
)
{
if
(
!
files
.
isEmpty
())
files
+=
QLatin1String
(
", "
);
files
+=
doc
->
fileName
();
}
return
WorkbenchIntegration
::
tr
(
"The class definition of '%1' could not be found in %2."
).
arg
(
uiClassName
,
files
);
}
WorkbenchIntegration
::
WorkbenchIntegration
(
QDesignerFormEditorInterface
*
core
,
FormEditorW
*
parent
)
:
WorkbenchIntegration
::
WorkbenchIntegration
(
QDesignerFormEditorInterface
*
core
,
FormEditorW
*
parent
)
:
qdesigner_internal
::
QDesignerIntegration
(
core
,
::
qobject_cast
<
QObject
*>
(
parent
)),
qdesigner_internal
::
QDesignerIntegration
(
core
,
::
qobject_cast
<
QObject
*>
(
parent
)),
m_few
(
parent
)
m_few
(
parent
)
...
@@ -443,8 +457,20 @@ static QString addParameterNames(const QString &functionSignature, const QString
...
@@ -443,8 +457,20 @@ static QString addParameterNames(const QString &functionSignature, const QString
return
functionName
;
return
functionName
;
}
}
void
WorkbenchIntegration
::
slotNavigateToSlot
(
const
QString
&
objectName
,
const
QString
&
signalSignature
,
void
WorkbenchIntegration
::
slotNavigateToSlot
(
const
QString
&
objectName
,
const
QString
&
signalSignature
,
const
QStringList
&
parameterNames
)
const
QStringList
&
parameterNames
)
{
QString
errorMessage
;
if
(
!
navigateToSlot
(
objectName
,
signalSignature
,
parameterNames
,
&
errorMessage
)
&&
!
errorMessage
.
isEmpty
())
{
QMessageBox
::
critical
(
m_few
->
designerEditor
()
->
topLevel
(),
tr
(
"Error finding source file"
),
errorMessage
);
}
}
bool
WorkbenchIntegration
::
navigateToSlot
(
const
QString
&
objectName
,
const
QString
&
signalSignature
,
const
QStringList
&
parameterNames
,
QString
*
errorMessage
)
{
{
const
QString
currentUiFile
=
m_few
->
activeFormWindow
()
->
file
()
->
fileName
();
const
QString
currentUiFile
=
m_few
->
activeFormWindow
()
->
file
()
->
fileName
();
...
@@ -457,14 +483,22 @@ void WorkbenchIntegration::slotNavigateToSlot(const QString &objectName, const Q
...
@@ -457,14 +483,22 @@ void WorkbenchIntegration::slotNavigateToSlot(const QString &objectName, const Q
const
QString
uicedName
=
QLatin1String
(
"ui_"
)
+
fi
.
baseName
()
+
QLatin1String
(
".h"
);
const
QString
uicedName
=
QLatin1String
(
"ui_"
)
+
fi
.
baseName
()
+
QLatin1String
(
".h"
);
QList
<
Document
::
Ptr
>
docList
=
findDocumentsIncluding
(
uicedName
,
true
);
// change to false when we know the absolute path to generated ui_<>.h file
QList
<
Document
::
Ptr
>
docList
=
findDocumentsIncluding
(
uicedName
,
true
);
// change to false when we know the absolute path to generated ui_<>.h file
if
(
docList
.
isEmpty
())
return
;
if
(
debugSlotNavigation
)
qDebug
()
<<
objectName
<<
signalSignature
<<
"Looking for "
<<
uicedName
<<
" returned "
<<
docList
.
size
();
if
(
docList
.
isEmpty
())
{
*
errorMessage
=
tr
(
"No documents matching %1 could be found."
).
arg
(
uicedName
);
return
false
;
}
QDesignerFormWindowInterface
*
fwi
=
m_few
->
activeFormWindow
()
->
formWindow
();
QDesignerFormWindowInterface
*
fwi
=
m_few
->
activeFormWindow
()
->
formWindow
();
const
QString
uiClassName
=
fwi
->
mainContainer
()
->
objectName
();
const
QString
uiClassName
=
fwi
->
mainContainer
()
->
objectName
();
foreach
(
Document
::
Ptr
doc
,
docList
)
{
if
(
debugSlotNavigation
)
qDebug
()
<<
"Checking docs for "
<<
uiClassName
;
foreach
(
const
Document
::
Ptr
&
doc
,
docList
)
{
QString
namespaceName
;
// namespace of the class found
QString
namespaceName
;
// namespace of the class found
Class
*
cl
=
findClass
(
doc
->
globalNamespace
(),
uiClassName
,
&
namespaceName
);
Class
*
cl
=
findClass
(
doc
->
globalNamespace
(),
uiClassName
,
&
namespaceName
);
if
(
cl
)
{
if
(
cl
)
{
...
@@ -493,8 +527,10 @@ void WorkbenchIntegration::slotNavigateToSlot(const QString &objectName, const Q
...
@@ -493,8 +527,10 @@ void WorkbenchIntegration::slotNavigateToSlot(const QString &objectName, const Q
// jump to function definition
// jump to function definition
TextEditor
::
BaseTextEditor
::
openEditorAt
(
sourceDoc
->
fileName
(),
line
);
TextEditor
::
BaseTextEditor
::
openEditorAt
(
sourceDoc
->
fileName
(),
line
);
}
}
return
;
return
true
;
}
}
}
}
*
errorMessage
=
msgClassNotFound
(
uiClassName
,
docList
);
return
false
;
}
}
This diff is collapsed.
Click to expand it.
src/plugins/designer/workbenchintegration.h
+
4
−
0
View file @
e19c940d
...
@@ -57,6 +57,10 @@ public slots:
...
@@ -57,6 +57,10 @@ public slots:
private
slots
:
private
slots
:
void
slotNavigateToSlot
(
const
QString
&
objectName
,
const
QString
&
signalSignature
,
const
QStringList
&
parameterNames
);
void
slotNavigateToSlot
(
const
QString
&
objectName
,
const
QString
&
signalSignature
,
const
QStringList
&
parameterNames
);
private
:
private
:
bool
navigateToSlot
(
const
QString
&
objectName
,
const
QString
&
signalSignature
,
const
QStringList
&
parameterNames
,
QString
*
errorMessage
);
FormEditorW
*
m_few
;
FormEditorW
*
m_few
;
};
};
...
...
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