Skip to content

Commit 834c630

Browse files
committedSep 1, 2014
added new QgsDateTimeEdit to custom widgets
1 parent 01b290c commit 834c630

File tree

4 files changed

+211
-0
lines changed

4 files changed

+211
-0
lines changed
 

‎src/customwidgets/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ SET (QGIS_CUSTOMWIDGETS_SRCS
1818
qgscollapsiblegroupboxplugin.cpp
1919
qgscolorbuttonplugin.cpp
2020
qgscolorbuttonv2plugin.cpp
21+
qgsdatetimeeditplugin.cpp
2122
qgsdatadefinedbuttonplugin.cpp
2223
qgsfieldcomboboxplugin.cpp
2324
qgsfieldexpressionwidgetplugin.cpp
@@ -32,6 +33,7 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
3233
qgscollapsiblegroupboxplugin.h
3334
qgscolorbuttonplugin.h
3435
qgscolorbuttonv2plugin.h
36+
qgsdatetimeeditplugin.h
3537
qgsdatadefinedbuttonplugin.h
3638
qgsfieldcomboboxplugin.h
3739
qgsfieldexpressionwidgetplugin.h
@@ -54,6 +56,7 @@ SET(QGIS_CUSTOMWIDGETS_HDRS
5456
qgscollapsiblegroupboxplugin.h
5557
qgscolorbuttonplugin.h
5658
qgscolorbuttonv2plugin.h
59+
qgsdatetimeeditplugin.h
5760
qgsdatadefinedbuttonplugin.h
5861
qgsfieldcomboboxplugin.h
5962
qgsfieldexpressionwidgetplugin.h

‎src/customwidgets/CMakeLists.txt.user

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE QtCreatorProject>
3+
<!-- Written by QtCreator 3.0.1, 2014-09-01T10:16:06. -->
4+
<qtcreator>
5+
<data>
6+
<variable>ProjectExplorer.Project.ActiveTarget</variable>
7+
<value type="int">-1</value>
8+
</data>
9+
<data>
10+
<variable>ProjectExplorer.Project.EditorSettings</variable>
11+
<valuemap type="QVariantMap">
12+
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13+
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14+
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15+
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16+
<value type="QString" key="language">Cpp</value>
17+
<valuemap type="QVariantMap" key="value">
18+
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
19+
</valuemap>
20+
</valuemap>
21+
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22+
<value type="QString" key="language">QmlJS</value>
23+
<valuemap type="QVariantMap" key="value">
24+
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
25+
</valuemap>
26+
</valuemap>
27+
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28+
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
29+
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30+
<value type="int" key="EditorConfiguration.IndentSize">4</value>
31+
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32+
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33+
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
34+
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35+
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36+
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37+
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38+
<value type="int" key="EditorConfiguration.TabSize">8</value>
39+
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40+
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41+
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42+
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43+
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44+
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45+
</valuemap>
46+
</data>
47+
<data>
48+
<variable>ProjectExplorer.Project.PluginSettings</variable>
49+
<valuemap type="QVariantMap"/>
50+
</data>
51+
<data>
52+
<variable>ProjectExplorer.Project.TargetCount</variable>
53+
<value type="int">0</value>
54+
</data>
55+
<data>
56+
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
57+
<value type="QByteArray">{316279e7-c793-4c38-a9aa-b021b7d95d28}</value>
58+
</data>
59+
<data>
60+
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
61+
<value type="int">15</value>
62+
</data>
63+
</qtcreator>
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/***************************************************************************
2+
qgsdatetimeeditplugin.cpp
3+
--------------------------------------
4+
Date : 01.09.2014
5+
Copyright : (C) 2014 Denis Rouzaud
6+
Email : denis.rouzaud@gmail.com
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
16+
#include "qgiscustomwidgets.h"
17+
#include "qgsdatetimeeditplugin.h"
18+
#include "qgsdatetimeedit.h"
19+
20+
21+
QgsDateTimeEditPlugin::QgsDateTimeEditPlugin( QObject *parent )
22+
: QObject( parent )
23+
, mInitialized( false )
24+
{
25+
}
26+
27+
28+
QString QgsDateTimeEditPlugin::name() const
29+
{
30+
return "QgsDateTimeEdit";
31+
}
32+
33+
QString QgsDateTimeEditPlugin::group() const
34+
{
35+
return QgisCustomWidgets::groupName();
36+
}
37+
38+
QString QgsDateTimeEditPlugin::includeFile() const
39+
{
40+
return "qgsdatetimeedit.h";
41+
}
42+
43+
QIcon QgsDateTimeEditPlugin::icon() const
44+
{
45+
return QIcon();
46+
}
47+
48+
bool QgsDateTimeEditPlugin::isContainer() const
49+
{
50+
return false;
51+
}
52+
53+
QWidget *QgsDateTimeEditPlugin::createWidget( QWidget *parent )
54+
{
55+
return new QgsDateTimeEdit( parent );
56+
}
57+
58+
bool QgsDateTimeEditPlugin::isInitialized() const
59+
{
60+
return mInitialized;
61+
}
62+
63+
void QgsDateTimeEditPlugin::initialize( QDesignerFormEditorInterface *core )
64+
{
65+
Q_UNUSED( core );
66+
if ( mInitialized )
67+
return;
68+
mInitialized = true;
69+
}
70+
71+
72+
QString QgsDateTimeEditPlugin::toolTip() const
73+
{
74+
return tr( "Define date" );
75+
}
76+
77+
QString QgsDateTimeEditPlugin::whatsThis() const
78+
{
79+
return "";
80+
}
81+
82+
QString QgsDateTimeEditPlugin::domXml() const
83+
{
84+
return QString( "<ui language=\"c++\">\n"
85+
" <widget class=\"%1\" name=\"mDateTimeEdit\">\n"
86+
" <property name=\"geometry\">\n"
87+
" <rect>\n"
88+
" <x>0</x>\n"
89+
" <y>0</y>\n"
90+
" <width>90</width>\n"
91+
" <height>27</height>\n"
92+
" </rect>\n"
93+
" </property>\n"
94+
" </widget>\n"
95+
"</ui>\n" )
96+
.arg( name() );
97+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/***************************************************************************
2+
qgsdatetimeeditplugin.h
3+
--------------------------------------
4+
Date : 01.09.2014
5+
Copyright : (C) 2014 Denis Rouzaud
6+
Email : denis.rouzaud@gmail.com
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
16+
#ifndef QGSDATETIMEEDITPLUGIN_H
17+
#define QGSDATETIMEEDITPLUGIN_H
18+
19+
#include <QDesignerExportWidget>
20+
#include <QDesignerCustomWidgetInterface>
21+
22+
23+
class CUSTOMWIDGETS_EXPORT QgsDateTimeEditPlugin : public QObject, public QDesignerCustomWidgetInterface
24+
{
25+
Q_OBJECT
26+
Q_INTERFACES( QDesignerCustomWidgetInterface )
27+
28+
public:
29+
explicit QgsDateTimeEditPlugin( QObject *parent = 0 );
30+
31+
private:
32+
bool mInitialized;
33+
34+
// QDesignerCustomWidgetInterface interface
35+
public:
36+
QString name() const;
37+
QString group() const;
38+
QString includeFile() const;
39+
QIcon icon() const;
40+
bool isContainer() const;
41+
QWidget *createWidget( QWidget *parent );
42+
bool isInitialized() const;
43+
void initialize( QDesignerFormEditorInterface *core );
44+
QString toolTip() const;
45+
QString whatsThis() const;
46+
QString domXml() const;
47+
};
48+
#endif // QGSDATETIMEEDITPLUGIN_H

0 commit comments

Comments
 (0)
Please sign in to comment.