Skip to content
Permalink
Browse files
custom widget for Qt Designer
  • Loading branch information
alexbruy committed Apr 8, 2017
1 parent 6ab2bd0 commit 228cc41a996f21a62112d408abd63a510ebe7953
@@ -14,6 +14,7 @@ SET (QGIS_CUSTOMWIDGETS_SRCS
qgiscustomwidgets.cpp
qgscollapsiblegroupboxplugin.cpp
qgscolorbuttonplugin.cpp
qgscheckablecomboboxplugin.cpp
qgsdatetimeeditplugin.cpp
qgsdockwidgetplugin.cpp
qgsdoublespinboxplugin.cpp
@@ -40,6 +41,7 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
qgiscustomwidgets.h
qgscollapsiblegroupboxplugin.h
qgscolorbuttonplugin.h
qgscheckablecomboboxplugin.h
qgsdatetimeeditplugin.h
qgsdockwidgetplugin.h
qgsdoublespinboxplugin.h
@@ -0,0 +1,97 @@
/***************************************************************************
qgscheckablecomboboxplugin.cpp
--------------------------------------
Date : March 22, 2017
Copyright : (C) 2017 Alexander Bruy
Email : alexander dot bruy at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgiscustomwidgets.h"
#include "qgscheckablecombobox.h"
#include "qgscheckablecomboboxplugin.h"


QgsCheckableComboBoxPlugin::QgsCheckableComboBoxPlugin( QObject *parent )
: QObject( parent )
, mInitialized( false )
{
}


QString QgsCheckableComboBoxPlugin::name() const
{
return "QgsCheckableComboBox";
}

QString QgsCheckableComboBoxPlugin::group() const
{
return QgisCustomWidgets::groupName();
}

QString QgsCheckableComboBoxPlugin::includeFile() const
{
return "qgscheckablecombobox.h";
}

QIcon QgsCheckableComboBoxPlugin::icon() const
{
return QIcon( ":/images/icons/qgis-icon-60x60.png" );
}

bool QgsCheckableComboBoxPlugin::isContainer() const
{
return false;
}

QWidget *QgsCheckableComboBoxPlugin::createWidget( QWidget *parent )
{
return new QgsCheckableComboBox( parent );
}

bool QgsCheckableComboBoxPlugin::isInitialized() const
{
return mInitialized;
}

void QgsCheckableComboBoxPlugin::initialize( QDesignerFormEditorInterface *core )
{
Q_UNUSED( core );
if ( mInitialized )
return;
mInitialized = true;
}


QString QgsCheckableComboBoxPlugin::toolTip() const
{
return "";
}

QString QgsCheckableComboBoxPlugin::whatsThis() const
{
return "";
}

QString QgsCheckableComboBoxPlugin::domXml() const
{
return QString( "<ui language=\"c++\">\n"
" <widget class=\"%1\" name=\"mComboBox\">\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>160</width>\n"
" <height>27</height>\n"
" </rect>\n"
" </property>\n"
" </widget>\n"
"</ui>\n" )
.arg( name() );
}
@@ -0,0 +1,51 @@
/***************************************************************************
qgscheckablecomboboxplugin.h
--------------------------------------
Date : March 22, 2017
Copyright : (C) 2017 Alexander Bruy
Email : alexander dot bruy at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSCHECKABLECOMBOBOXPLUGIN_H
#define QGSCHECKABLECOMBOBOXPLUGIN_H


#include <QtGlobal>
#include <QtUiPlugin/QDesignerCustomWidgetInterface>
#include <QtUiPlugin/QDesignerExportWidget>
#include "qgis_customwidgets.h"


class CUSTOMWIDGETS_EXPORT QgsCheckableComboBoxPlugin : public QObject, public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES( QDesignerCustomWidgetInterface )

public:
explicit QgsCheckableComboBoxPlugin( QObject *parent = 0 );

private:
bool mInitialized = false;

// QDesignerCustomWidgetInterface interface
public:
QString name() const override;
QString group() const override;
QString includeFile() const override;
QIcon icon() const override;
bool isContainer() const override;
QWidget *createWidget( QWidget *parent ) override;
bool isInitialized() const override;
void initialize( QDesignerFormEditorInterface *core ) override;
QString toolTip() const override;
QString whatsThis() const override;
QString domXml() const override;
};
#endif // QGSCHECKABLECOMBOBOXPLUGIN_H
@@ -1,5 +1,5 @@
/***************************************************************************
qgsfilterlineeditplugin.cpp
qgspasswordlineeditplugin.cpp
--------------------------------------
Date : March 13, 2017
Copyright : (C) 2017 Alexander Bruy

0 comments on commit 228cc41

Please sign in to comment.