22#include "moc_qgshttpheaderwidget.cpp"
23#include "ui_qgshttpheaderwidget.h"
33 grpbxAdvanced->setCollapsed(
true );
36 connect( btnAddQueryPair, &QToolButton::clicked,
this, &QgsHttpHeaderWidget::addQueryPair );
37 connect( btnRemoveQueryPair, &QToolButton::clicked,
this, &QgsHttpHeaderWidget::removeQueryPair );
42void QgsHttpHeaderWidget::addQueryPairRow(
const QString &key,
const QString &val )
44 const int rowCnt = tblwdgQueryPairs->rowCount();
45 tblwdgQueryPairs->insertRow( rowCnt );
47 const Qt::ItemFlags itemFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable
48 | Qt::ItemIsEditable | Qt::ItemIsDropEnabled;
50 QTableWidgetItem *keyItem =
new QTableWidgetItem( key );
51 keyItem->setFlags( itemFlags );
52 tblwdgQueryPairs->setItem( rowCnt, 0, keyItem );
54 QTableWidgetItem *valueItem =
new QTableWidgetItem( val );
55 valueItem->setFlags( itemFlags );
56 tblwdgQueryPairs->setItem( rowCnt, 1, valueItem );
62 for (
int i = 0; i < tblwdgQueryPairs->rowCount(); ++i )
64 if ( tblwdgQueryPairs->item( i, 0 )->text().isEmpty() )
68 querypairs [ tblwdgQueryPairs->item( i, 0 )->text() ] = QVariant( tblwdgQueryPairs->item( i, 1 )->text() ) ;
71 if ( !mRefererLineEdit->text().isEmpty() )
73 querypairs [
"referer" ] = QVariant( mRefererLineEdit->text() ) ;
77 for (
auto k : querypairs.
keys() )
79 QgsLogger::debug( QString(
"httpHeaders called: %1=%2" ).arg( k, querypairs[k].toString() ) );
87void QgsHttpHeaderWidget::addQueryPair()
89 addQueryPairRow( QString(), QString() );
90 tblwdgQueryPairs->setFocus();
91 tblwdgQueryPairs->setCurrentCell( tblwdgQueryPairs->rowCount() - 1, 0 );
95void QgsHttpHeaderWidget::removeQueryPair()
97 tblwdgQueryPairs->removeRow( tblwdgQueryPairs->currentRow() );
112 for (
int i = tblwdgQueryPairs->rowCount(); i > 0; i-- )
113 tblwdgQueryPairs->removeRow( i - 1 );
116 QList<QString> lst = headers.
keys();
117 for (
auto ite = lst.constBegin(); ite != lst.constEnd(); ++ite )
119 if ( ite->compare(
"referer" ) != 0 )
121 addQueryPairRow( *ite, headers[ *ite ].toString() );
125 mRefererLineEdit->setText( headers[ *ite ].toString() );
134 h.updateSettings( settings, key );
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static void debug(const QString &msg, int debuglevel=1, const char *file=nullptr, const char *function=nullptr, int line=-1)
Goes to qDebug.
This class is a composition of two QSettings instances:
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH