Skip to content
GitLab
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
b04a4dde
Commit
b04a4dde
authored
Jul 28, 2010
by
Lasse Holmstedt
Browse files
Applied 07321dfceed41c1851781841e03c4148da47e41e to qmlobserver
Fixes issues with reloading freezing on Gnome
parent
31189a60
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/tools/qml/qmlobserver/qmlruntime.cpp
View file @
b04a4dde
...
...
@@ -94,7 +94,6 @@
#include
<QNetworkProxyFactory>
#include
<QKeyEvent>
#include
<QToolBar>
#include
<QDockWidget>
#include
<QMutex>
#include
<QMutexLocker>
#include
"proxysettings.h"
...
...
@@ -552,6 +551,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
,
tester
(
0
)
,
useQmlFileBrowser
(
true
)
,
translator
(
0
)
,
m_splitter
(
0
)
{
QDeclarativeViewer
::
registerTypes
();
setWindowTitle
(
tr
(
"Qt QML Viewer"
));
...
...
@@ -588,26 +588,19 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
canvas
=
new
QmlViewer
::
QDeclarativeDesignView
(
this
);
addToolBar
(
Qt
::
TopToolBarArea
,
canvas
->
toolbar
());
QSplitter
*
crumblePathSplitter
=
new
QSplitter
(
this
);
crumblePathSplitter
->
setOrientation
(
Qt
::
Vertical
);
crumblePathSplitter
->
addWidget
(
canvas
->
crumblePathWidget
());
crumblePathSplitter
->
addWidget
(
canvas
);
crumblePathSplitter
->
setHandleWidth
(
1
);
crumblePathSplitter
->
setCollapsible
(
0
,
false
);
crumblePathSplitter
->
setCollapsible
(
1
,
false
);
// QDockWidget *crumblePathWidget = new QDockWidget("Context path", this);
// crumblePathWidget->setWidget();
// crumblePathWidget->setAllowedAreas(Qt::TopDockWidgetArea);
// crumblePathWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
// crumblePathWidget->setTitleBarWidget(new QWidget(this));
// crumblePathWidget->setMinimumHeight(24);
// crumblePathWidget->setMaximumHeight(24);
setDocumentMode
(
true
);
setDockNestingEnabled
(
true
);
//addDockWidget(Qt::TopDockWidgetArea, crumblePathWidget);
m_splitter
=
new
QSplitter
(
this
);
m_splitter
->
setOrientation
(
Qt
::
Vertical
);
m_splitter
->
addWidget
(
canvas
->
crumblePathWidget
());
canvas
->
crumblePathWidget
()
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Minimum
);
m_splitter
->
addWidget
(
canvas
);
m_splitter
->
setHandleWidth
(
1
);
m_splitter
->
setStretchFactor
(
0
,
0
);
m_splitter
->
setStretchFactor
(
0
,
1000
);
m_splitter
->
setCollapsible
(
0
,
false
);
m_splitter
->
setCollapsible
(
1
,
false
);
m_splitter
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
);
//canvas->setSizePolicy(Qt:);
canvas
->
setAttribute
(
Qt
::
WA_OpaquePaintEvent
);
canvas
->
setAttribute
(
Qt
::
WA_NoSystemBackground
);
...
...
@@ -628,7 +621,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
setMenuBar
(
0
);
}
setCentralWidget
(
crumblePathS
plitter
);
setCentralWidget
(
m_s
plitter
);
namFactory
=
new
NetworkAccessManagerFactory
;
canvas
->
engine
()
->
setNetworkAccessManagerFactory
(
namFactory
);
...
...
@@ -953,6 +946,7 @@ void QDeclarativeViewer::addPluginPath(const QString& plugin)
void
QDeclarativeViewer
::
reload
()
{
canvas
->
setDesignModeBehavior
(
false
);
open
(
currentFileOrUrl
);
}
...
...
@@ -977,13 +971,7 @@ void QDeclarativeViewer::statusChanged()
if
(
canvas
->
status
()
==
QDeclarativeView
::
Ready
)
{
initialSize
=
canvas
->
initialSize
();
if
(
canvas
->
resizeMode
()
==
QDeclarativeView
::
SizeRootObjectToView
)
{
if
(
!
isFullScreen
()
&&
!
isMaximized
())
{
canvas
->
setFixedSize
(
initialSize
);
resize
(
1
,
1
);
// workaround for QMainWindowLayout NOT shrinking the window if the centralWidget() shrink
QTimer
::
singleShot
(
0
,
this
,
SLOT
(
updateSizeHints
()));
}
}
updateSizeHints
(
true
);
}
}
...
...
@@ -1108,13 +1096,9 @@ void QDeclarativeViewer::setRecordRate(int fps)
record_rate
=
fps
;
}
void
QDeclarativeViewer
::
sceneResized
(
QSize
size
)
void
QDeclarativeViewer
::
sceneResized
(
QSize
)
{
if
(
size
.
width
()
>
0
&&
size
.
height
()
>
0
)
{
if
(
canvas
->
resizeMode
()
==
QDeclarativeView
::
SizeViewToRootObject
)
{
updateSizeHints
();
}
}
updateSizeHints
();
}
void
QDeclarativeViewer
::
keyPressEvent
(
QKeyEvent
*
event
)
...
...
@@ -1377,17 +1361,7 @@ void QDeclarativeViewer::changeOrientation(QAction *action)
void
QDeclarativeViewer
::
orientationChanged
()
{
if
(
canvas
->
resizeMode
()
==
QDeclarativeView
::
SizeRootObjectToView
)
{
if
(
canvas
->
rootObject
())
{
QSizeF
rootObjectSize
=
canvas
->
rootObject
()
->
boundingRect
().
size
();
if
(
size
()
!=
rootObjectSize
.
toSize
())
{
canvas
->
setMinimumSize
(
rootObjectSize
.
toSize
());
canvas
->
resize
(
rootObjectSize
.
toSize
());
resize
(
rootObjectSize
.
toSize
());
resize
(
1
,
1
);
// workaround for QMainWindowLayout NOT shrinking the window if the centralWidget() shrinks
}
}
}
updateSizeHints
();
}
void
QDeclarativeViewer
::
setDeviceKeys
(
bool
on
)
...
...
@@ -1436,22 +1410,37 @@ void QDeclarativeViewer::setSizeToView(bool sizeToView)
}
}
void
QDeclarativeViewer
::
updateSizeHints
()
void
QDeclarativeViewer
::
updateSizeHints
(
bool
initial
)
{
if
(
canvas
->
resizeMode
()
==
QDeclarativeView
::
SizeViewToRootObject
)
{
QSize
newWindowSize
=
canvas
->
sizeHint
();
static
bool
isRecursive
=
false
;
if
(
isRecursive
)
return
;
isRecursive
=
true
;
if
(
initial
||
(
canvas
->
resizeMode
()
==
QDeclarativeView
::
SizeViewToRootObject
))
{
QSize
newWindowSize
=
initial
?
initialSize
:
canvas
->
sizeHint
();
//qWarning() << "USH:" << (initial ? "INIT:" : "V2R:") << "setting fixed size " << newWindowSize;
if
(
!
isFullScreen
()
&&
!
isMaximized
())
{
canvas
->
setMinimumSize
(
newWindowSize
);
canvas
->
resize
(
newWindowSize
);
resize
(
1
,
1
);
// workaround for QMainWindowLayout NOT shrinking the window if the centralWidget() shrinks
canvas
->
setMinimumSize
(
QSize
(
0
,
0
));
canvas
->
setFixedSize
(
newWindowSize
);
resize
(
1
,
1
);
layout
()
->
setSizeConstraint
(
QLayout
::
SetFixedSize
);
layout
()
->
activate
();
}
}
else
{
// QDeclarativeView::SizeRootObjectToView
canvas
->
setMinimumSize
(
QSize
(
0
,
0
));
canvas
->
setMaximumSize
(
QSize
(
16777215
,
16777215
));
}
//qWarning() << "USH: R2V: setting free size ";
layout
()
->
setSizeConstraint
(
QLayout
::
SetNoConstraint
);
layout
()
->
activate
();
setMaximumSize
(
QSize
(
QWIDGETSIZE_MAX
,
QWIDGETSIZE_MAX
));
canvas
->
setMinimumSize
(
QSize
(
0
,
0
));
canvas
->
setMaximumSize
(
QSize
(
QWIDGETSIZE_MAX
,
QWIDGETSIZE_MAX
));
isRecursive
=
false
;
}
void
QDeclarativeViewer
::
registerTypes
()
{
static
bool
registered
=
false
;
...
...
src/tools/qml/qmlobserver/qmlruntime.h
View file @
b04a4dde
...
...
@@ -67,6 +67,7 @@ class NetworkAccessManagerFactory;
class
QTranslator
;
class
QActionGroup
;
class
QMenuBar
;
class
QSplitter
;
class
QDeclarativeViewer
:
public
QMainWindow
...
...
@@ -151,9 +152,10 @@ private slots:
void
warningsWidgetOpened
();
void
warningsWidgetClosed
();
void
updateSizeHints
();
private:
void
updateSizeHints
(
bool
initial
=
false
);
QString
getVideoFileName
();
LoggerWidget
*
loggerWindow
;
...
...
@@ -199,6 +201,8 @@ private:
bool
useQmlFileBrowser
;
QSplitter
*
m_splitter
;
QTranslator
*
translator
;
void
loadTranslationFile
(
const
QString
&
directory
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment