22#include "ui_qgshttpheaderwidget.h"
32 grpbxAdvanced->setCollapsed(
true );
35 connect( btnAddQueryPair, &QToolButton::clicked,
this, &QgsHttpHeaderWidget::addQueryPair );
36 connect( btnRemoveQueryPair, &QToolButton::clicked,
this, &QgsHttpHeaderWidget::removeQueryPair );
41void QgsHttpHeaderWidget::addQueryPairRow(
const QString &key,
const QString &val )
43 const int rowCnt = tblwdgQueryPairs->rowCount();
44 tblwdgQueryPairs->insertRow( rowCnt );
46 const Qt::ItemFlags itemFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable
47 | Qt::ItemIsEditable | Qt::ItemIsDropEnabled;
49 QTableWidgetItem *keyItem =
new QTableWidgetItem( key );
50 keyItem->setFlags( itemFlags );
51 tblwdgQueryPairs->setItem( rowCnt, 0, keyItem );
53 QTableWidgetItem *valueItem =
new QTableWidgetItem( val );
54 valueItem->setFlags( itemFlags );
55 tblwdgQueryPairs->setItem( rowCnt, 1, valueItem );
61 for (
int i = 0; i < tblwdgQueryPairs->rowCount(); ++i )
63 if ( tblwdgQueryPairs->item( i, 0 )->text().isEmpty() )
67 querypairs [ tblwdgQueryPairs->item( i, 0 )->text() ] = QVariant( tblwdgQueryPairs->item( i, 1 )->text() ) ;
70 if ( !mRefererLineEdit->text().isEmpty() )
72 querypairs [
"referer" ] = QVariant( mRefererLineEdit->text() ) ;
76 for (
auto k : querypairs.
keys() )
78 QgsLogger::debug( QString(
"httpHeaders called: %1=%2" ).arg( k, querypairs[k].toString() ) );
86void QgsHttpHeaderWidget::addQueryPair()
88 addQueryPairRow( QString(), QString() );
89 tblwdgQueryPairs->setFocus();
90 tblwdgQueryPairs->setCurrentCell( tblwdgQueryPairs->rowCount() - 1, 0 );
94void QgsHttpHeaderWidget::removeQueryPair()
96 tblwdgQueryPairs->removeRow( tblwdgQueryPairs->currentRow() );
111 for (
int i = tblwdgQueryPairs->rowCount(); i > 0; i-- )
112 tblwdgQueryPairs->removeRow( i - 1 );
115 QList<QString> lst = headers.
keys();
116 for (
auto ite = lst.constBegin(); ite != lst.constEnd(); ++ite )
118 if ( ite->compare(
"referer" ) != 0 )
120 addQueryPairRow( *ite, headers[ *ite ].toString() );
124 mRefererLineEdit->setText( headers[ *ite ].toString() );
133 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