20 #include <QGridLayout> 21 #include <QFileDialog> 29 , mPhotoLabel( nullptr )
30 , mPhotoPixmapLabel( nullptr )
31 , mLineEdit( nullptr )
39 void QgsPhotoWidgetWrapper::selectFileName()
58 void QgsPhotoWidgetWrapper::loadPixmap(
const QString& fileName )
74 if (
QUrl( fileName ).isRelative() )
80 mWebView->setUrl( filePath );
85 if ( !pm.
isNull() && mPhotoLabel )
97 if ( mPhotoPixmapLabel )
110 pm = pm.
scaled( size, Qt::KeepAspectRatio, Qt::SmoothTransformation );
120 void QgsPhotoWidgetWrapper::clearPicture()
124 mPhotoLabel->
clear();
127 if ( mPhotoPixmapLabel )
143 v = mLineEdit->
text();
156 mPhotoLabel->
clear();
157 if ( mPhotoPixmapLabel )
158 mPhotoPixmapLabel->
clear();
186 mLineEdit = qobject_cast<
QLineEdit*>( editor );
188 mWebView = qobject_cast<
QWebView*>( editor );
218 connect( mButton, SIGNAL( clicked() ),
this, SLOT( selectFileName() ) );
237 return mPhotoLabel || mLineEdit || mButton || mWebView;
239 return mPhotoLabel || mLineEdit || mButton;
270 void QgsPhotoWidgetWrapper::updateConstraintWidgetStatus(
bool constraintValid )
274 if ( constraintValid )
278 mLineEdit->
setStyleSheet(
"QgsFilterLineEdit { background-color: #dd7777; }" );
QString toNativeSeparators(const QString &pathName)
void setHeight(int height)
QString relativeFilePath(const QString &fileName) const
void setContentsMargins(int left, int top, int right, int bottom)
void setPixmap(const QPixmap &)
void setPixmap(const QPixmap &)
QString filePath(const QString &fileName) const
QString tr(const char *sourceText, const char *disambiguation, int n)
void setObjectName(const QString &name)
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
QPixmap scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const
void setMargin(int margin)
QString cleanPath(const QString &path)
QVariant value(const QString &key, const QVariant &defaultValue) const
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
static QgsProject * instance()
Returns the QgsProject singleton instance.
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFlags< QFileDialog::Option > options)
void setNullValue(const QString &nullValue)
Sets the string representation for null values in the widget.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Represents a vector layer which manages a vector based data sets.
The QgsPixmapLabel class shows a pixmap and adjusts its size to the space given to the widget by the ...
T findChild(const QString &name) const