Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
e19c940d
Commit
e19c940d
authored
Dec 16, 2008
by
Friedemann Kleint
Browse files
Fixes: Give a warning when goto slot fails
parent
8f50e94c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/designer/workbenchintegration.cpp
View file @
e19c940d
...
...
@@ -53,14 +53,28 @@
#include <QtDesigner/QDesignerFormWindowInterface>
#include <Qt
Core/QFileInfo
>
#include <Qt
Gui/QMessageBox
>
#include <QtCore/QFileInfo>
#include <QtCore/QDebug>
enum
{
debugSlotNavigation
=
0
};
using
namespace
Designer
::
Internal
;
using
namespace
CPlusPlus
;
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
)
:
qdesigner_internal
::
QDesignerIntegration
(
core
,
::
qobject_cast
<
QObject
*>
(
parent
)),
m_few
(
parent
)
...
...
@@ -443,8 +457,20 @@ static QString addParameterNames(const QString &functionSignature, const QString
return
functionName
;
}
void
WorkbenchIntegration
::
slotNavigateToSlot
(
const
QString
&
objectName
,
const
QString
&
signalSignature
,
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
();
...
...
@@ -457,14 +483,22 @@ void WorkbenchIntegration::slotNavigateToSlot(const QString &objectName, const Q
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
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
();
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
Class
*
cl
=
findClass
(
doc
->
globalNamespace
(),
uiClassName
,
&
namespaceName
);
if
(
cl
)
{
...
...
@@ -493,8 +527,10 @@ void WorkbenchIntegration::slotNavigateToSlot(const QString &objectName, const Q
// jump to function definition
TextEditor
::
BaseTextEditor
::
openEditorAt
(
sourceDoc
->
fileName
(),
line
);
}
return
;
return
true
;
}
}
*
errorMessage
=
msgClassNotFound
(
uiClassName
,
docList
);
return
false
;
}
src/plugins/designer/workbenchintegration.h
View file @
e19c940d
...
...
@@ -57,6 +57,10 @@ public slots:
private
slots
:
void
slotNavigateToSlot
(
const
QString
&
objectName
,
const
QString
&
signalSignature
,
const
QStringList
&
parameterNames
);
private:
bool
navigateToSlot
(
const
QString
&
objectName
,
const
QString
&
signalSignature
,
const
QStringList
&
parameterNames
,
QString
*
errorMessage
);
FormEditorW
*
m_few
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment