Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qtquickcontrols-nemo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NemoMobile
qtquickcontrols-nemo
Commits
42a25f7b
Commit
42a25f7b
authored
Apr 07, 2017
by
Chupligin Sergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Sizing] add simple sizing class
parent
156318cb
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
3 deletions
+84
-3
qtquickcontrols-nemo.spec
rpm/qtquickcontrols-nemo.spec
+1
-1
controls.pro
src/controls/controls.pro
+4
-2
qquicknemocontrolsextensionplugin.cpp
src/controls/qquicknemocontrolsextensionplugin.cpp
+7
-0
sizing.cpp
src/controls/sizing.cpp
+45
-0
sizing.h
src/controls/sizing.h
+27
-0
No files found.
rpm/qtquickcontrols-nemo.spec
View file @
42a25f7b
Name: qt5-qtquickcontrols-nemo
Summary: Nemomobile Qt Quick Controls
Version: 5.
1.3
Version: 5.
2.0
Release: nemo1
Group: Qt/Qt
License: LGPLv2.1 with exception or GPLv3
...
...
src/controls/controls.pro
View file @
42a25f7b
...
...
@@ -34,7 +34,8 @@ HEADERS += \
qquickfilteringmousearea
.
h
\
nemoimageprovider
.
h
\
themedaemon
/
mlocalthemedaemonclient
.
h
\
themedaemon
/
mabstractthemedaemonclient
.
h
themedaemon
/
mabstractthemedaemonclient
.
h
\
sizing
.
h
SOURCES
+=
\
qquicknemocontrolsextensionplugin
.
cpp
\
...
...
@@ -44,7 +45,8 @@ SOURCES += \
qquickfilteringmousearea
.
cpp
\
nemoimageprovider
.
cpp
\
themedaemon
/
mlocalthemedaemonclient
.
cpp
\
themedaemon
/
mabstractthemedaemonclient
.
cpp
themedaemon
/
mabstractthemedaemonclient
.
cpp
\
sizing
.
cpp
target
.
path
=
$$
[
QT_INSTALL_QML
]
/
$$
PLUGIN_IMPORT_PATH
...
...
src/controls/qquicknemocontrolsextensionplugin.cpp
View file @
42a25f7b
...
...
@@ -25,6 +25,7 @@
#include "nemopage.h"
#include "qquickfilteringmousearea.h"
#include "nemoimageprovider.h"
#include "sizing.h"
QQuickNemoControlsExtensionPlugin
::
QQuickNemoControlsExtensionPlugin
(
QObject
*
parent
)
:
QQmlExtensionPlugin
(
parent
)
...
...
@@ -48,7 +49,13 @@ void QQuickNemoControlsExtensionPlugin::registerTypes(const char *uri)
void
QQuickNemoControlsExtensionPlugin
::
initializeEngine
(
QQmlEngine
*
engine
,
const
char
*
uri
)
{
Sizing
*
sizing
=
new
Sizing
();
QQmlExtensionPlugin
::
initializeEngine
(
engine
,
uri
);
QQmlContext
*
context
=
engine
->
rootContext
();
context
->
setContextProperty
(
"mm"
,
sizing
->
getScaleFactor
());
engine
->
addImageProvider
(
QLatin1String
(
"theme"
),
new
NemoImageProvider
);
}
src/controls/sizing.cpp
0 → 100644
View file @
42a25f7b
#include "sizing.h"
#include <QScreen>
#include <QDebug>
#include <QGuiApplication>
Sizing
::
Sizing
(
QObject
*
parent
)
:
QObject
(
parent
)
{
m_valid
=
false
;
m_scale_factor
=
10
;
m_p_height
=
qgetenv
(
"QT_QPA_EGLFS_PHYSICAL_HEIGHT"
).
toInt
();
m_p_width
=
qgetenv
(
"QT_QPA_EGLFS_PHYSICAL_WIDTH"
).
toInt
();
QScreen
*
screen
=
QGuiApplication
::
primaryScreen
();
m_height
=
screen
->
size
().
height
();
m_width
=
screen
->
size
().
width
();
if
(
m_p_height
>
0
&&
m_p_width
>
0
){
m_valid
=
true
;
scaleFactor
();
}
else
{
if
(
m_p_height
==
0
){
qWarning
(
"QT_QPA_EGLFS_PHYSICAL_HEIGHT is not set!"
);
}
if
(
m_p_width
==
0
){
qWarning
(
"QT_QPA_EGLFS_PHYSICAL_WIDTH is not set!"
);
}
qWarning
(
"Device sizing don`t work"
);
}
}
void
Sizing
::
scaleFactor
()
{
if
(
m_p_width
!=
0
){
m_scale_factor
=
m_width
/
m_p_width
;
}
qDebug
()
<<
"Scale factor is "
<<
m_scale_factor
;
}
src/controls/sizing.h
0 → 100644
View file @
42a25f7b
#ifndef SIZING_H
#define SIZING_H
#include <QObject>
class
Sizing
:
public
QObject
{
Q_OBJECT
public:
explicit
Sizing
(
QObject
*
parent
=
0
);
bool
isValid
(){
return
m_valid
;}
int
getScaleFactor
(){
return
m_scale_factor
;}
private:
bool
m_valid
;
int
m_p_width
;
int
m_p_height
;
int
m_width
;
int
m_height
;
int
m_scale_factor
;
void
scaleFactor
();
};
#endif // SIZING_H
Write
Preview
Markdown
is supported
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