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
40ccb20a
Commit
40ccb20a
authored
Oct 19, 2017
by
Chupligin Sergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CalendarModel] Move DateListModel to CalendarModel
parent
847eb1fb
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
82 additions
and
17 deletions
+82
-17
qtquickcontrols-nemo.spec
rpm/qtquickcontrols-nemo.spec
+1
-0
controls.pro
src/controls/controls.pro
+2
-4
qquicknemocontrolsextensionplugin.cpp
src/controls/qquicknemocontrolsextensionplugin.cpp
+0
-2
calendarmodel.cpp
src/models/calendarmodel.cpp
+9
-9
calendarmodel.h
src/models/calendarmodel.h
+2
-2
models.pro
src/models/models.pro
+19
-0
plugin.cpp
src/models/plugin.cpp
+46
-0
qmldir
src/models/qmldir
+2
-0
src.pro
src/src.pro
+1
-0
No files found.
rpm/qtquickcontrols-nemo.spec
View file @
40ccb20a
...
...
@@ -63,6 +63,7 @@ desktop-file-install --delete-original \
%files
%defattr(-,root,root,-)
%{_libdir}/qt5/qml/org/nemomobile/models/
%{_libdir}/qt5/qml/QtQuick/Controls/Nemo
%{_libdir}/qt5/qml/QtQuick/Controls/Styles/Nemo
...
...
src/controls/controls.pro
View file @
40ccb20a
...
...
@@ -39,8 +39,7 @@ HEADERS += \
themedaemon
/
mlocalthemedaemonclient
.
h
\
themedaemon
/
mabstractthemedaemonclient
.
h
\
sizing
.
h
\
theme
.
h
\
datelistmodel
.
h
theme
.
h
SOURCES
+=
\
qquicknemocontrolsextensionplugin
.
cpp
\
...
...
@@ -52,8 +51,7 @@ SOURCES += \
themedaemon
/
mlocalthemedaemonclient
.
cpp
\
themedaemon
/
mabstractthemedaemonclient
.
cpp
\
sizing
.
cpp
\
theme
.
cpp
\
datelistmodel
.
cpp
theme
.
cpp
target
.
path
=
$$
[
QT_INSTALL_QML
]
/
$$
PLUGIN_IMPORT_PATH
...
...
src/controls/qquicknemocontrolsextensionplugin.cpp
View file @
40ccb20a
...
...
@@ -27,7 +27,6 @@
#include "nemoimageprovider.h"
#include "sizing.h"
#include "theme.h"
#include "datelistmodel.h"
QQuickNemoControlsExtensionPlugin
::
QQuickNemoControlsExtensionPlugin
(
QObject
*
parent
)
:
QQmlExtensionPlugin
(
parent
)
...
...
@@ -47,7 +46,6 @@ void QQuickNemoControlsExtensionPlugin::registerTypes(const char *uri)
qmlRegisterType
<
NemoWindow
>
(
uri
,
1
,
0
,
"NemoWindow"
);
qmlRegisterType
<
NemoPage
>
(
uri
,
1
,
0
,
"NemoPage"
);
qmlRegisterType
<
QQuickFilteringMouseArea
>
(
uri
,
1
,
0
,
"FilteringMouseArea"
);
qmlRegisterType
<
DateListModel
>
(
uri
,
1
,
0
,
"NemoDateListModel"
);
}
void
QQuickNemoControlsExtensionPlugin
::
initializeEngine
(
QQmlEngine
*
engine
,
const
char
*
uri
)
...
...
src/
controls/datelist
model.cpp
→
src/
models/calendar
model.cpp
View file @
40ccb20a
...
...
@@ -29,9 +29,9 @@
**
****************************************************************************************/
#include "
datelist
model.h"
#include "
calendar
model.h"
DateListModel
::
DateList
Model
(
QObject
*
parent
)
:
CalendarModel
::
Calendar
Model
(
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
{
...
...
@@ -49,13 +49,13 @@ DateListModel::DateListModel(QObject *parent) :
fill
();
}
int
DateList
Model
::
rowCount
(
const
QModelIndex
&
parent
)
const
int
Calendar
Model
::
rowCount
(
const
QModelIndex
&
parent
)
const
{
Q_UNUSED
(
parent
);
return
m_dateList
.
count
();
}
QVariant
DateList
Model
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
QVariant
Calendar
Model
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
Q_UNUSED
(
role
);
if
(
!
index
.
isValid
())
...
...
@@ -86,7 +86,7 @@ QVariant DateListModel::data(const QModelIndex &index, int role) const
}
}
QVariant
DateList
Model
::
get
(
const
int
idx
)
QVariant
Calendar
Model
::
get
(
const
int
idx
)
{
if
(
idx
>=
m_dateList
.
size
())
{
...
...
@@ -105,7 +105,7 @@ QVariant DateListModel::get(const int idx)
return
QVariant
(
itemData
);
}
void
DateList
Model
::
setSelectedDate
(
QDate
date
)
void
Calendar
Model
::
setSelectedDate
(
QDate
date
)
{
if
(
m_selectedDate
!=
date
)
{
...
...
@@ -114,7 +114,7 @@ void DateListModel::setSelectedDate(QDate date)
}
}
void
DateList
Model
::
setMonth
(
int
month
)
void
Calendar
Model
::
setMonth
(
int
month
)
{
if
(
m_month
!=
month
&&
month
>
0
&&
month
<
13
)
{
...
...
@@ -124,7 +124,7 @@ void DateListModel::setMonth(int month)
}
}
void
DateList
Model
::
setYear
(
int
year
)
void
Calendar
Model
::
setYear
(
int
year
)
{
if
(
m_year
!=
year
)
{
...
...
@@ -134,7 +134,7 @@ void DateListModel::setYear(int year)
}
}
void
DateList
Model
::
fill
()
void
Calendar
Model
::
fill
()
{
}
src/
controls/datelist
model.h
→
src/
models/calendar
model.h
View file @
40ccb20a
...
...
@@ -35,7 +35,7 @@
#include <QAbstractListModel>
#include <QDate>
class
DateList
Model
:
public
QAbstractListModel
class
Calendar
Model
:
public
QAbstractListModel
{
Q_OBJECT
struct
dateItem
{
...
...
@@ -52,7 +52,7 @@ class DateListModel : public QAbstractListModel
Q_PROPERTY
(
QDate
selectedDate
READ
selectedDate
WRITE
setSelectedDate
NOTIFY
selectedDateChanged
)
public:
explicit
DateList
Model
(
QObject
*
parent
=
0
);
explicit
Calendar
Model
(
QObject
*
parent
=
0
);
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
;
QHash
<
int
,
QByteArray
>
roleNames
()
const
{
return
m_hash
;}
...
...
src/models/models.pro
0 → 100644
View file @
40ccb20a
TEMPLATE
=
lib
TARGET
=
nemomodelsplugin
QT
+=
qml
CONFIG
+=
qt
plugin
hide_symbols
SOURCES
+=
\
calendarmodel
.
cpp
\
plugin
.
cpp
HEADERS
+=
\
calendarmodel
.
h
target
.
path
=
/
usr
/
lib
/
qt5
/
qml
/
org
/
nemomobile
/
models
/
INSTALLS
+=
target
DISTFILES
+=
\
qmldir
src/models/plugin.cpp
0 → 100644
View file @
40ccb20a
/*
* Copyright (C) 2017 Chupligin Sergey <neochapay@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "calendarmodel.h"
#include <QtQml>
#include <QtGlobal>
#include <QQmlEngine>
#include <QQmlExtensionPlugin>
class
Q_DECL_EXPORT
NemoSettingsPlugin
:
public
QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA
(
IID
"org.nemomobile.models"
)
public:
virtual
~
NemoSettingsPlugin
()
{
}
void
initializeEngine
(
QQmlEngine
*
,
const
char
*
uri
)
{
Q_ASSERT
(
uri
==
QLatin1String
(
"org.nemomobile.models"
));
}
void
registerTypes
(
const
char
*
uri
)
{
Q_ASSERT
(
uri
==
QLatin1String
(
"org.nemomobile.models"
));
qmlRegisterType
<
CalendarModel
>
(
uri
,
1
,
0
,
"CalendarModel"
);
}
};
#include "plugin.moc"
src/models/qmldir
0 → 100644
View file @
40ccb20a
module org.nemomobile.models
plugin nemomodels
src/src.pro
View file @
40ccb20a
...
...
@@ -2,3 +2,4 @@ TEMPLATE = subdirs
SUBDIRS
+=
controls
SUBDIRS
+=
styles
SUBDIRS
+=
models
\ No newline at end of file
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