QList<QWidget*> ServiceItemDelegate::createItemWidgets() const { QCheckBox* checkBox = new QCheckBox(); QPalette palette = checkBox->palette(); palette.setColor(QPalette::WindowText, palette.color(QPalette::Text)); checkBox->setPalette(palette); connect(checkBox, SIGNAL(clicked(bool)), this, SLOT(slotCheckBoxClicked(bool))); KPushButton* configureButton = new KPushButton(); connect(configureButton, SIGNAL(clicked()), this, SLOT(slotConfigureButtonClicked())); return QList<QWidget*>() << checkBox << configureButton; }
void DiagramViewWrapper::headerDataChanged(Qt::Orientation orientation, int first, int last) { if (orientation == Qt::Horizontal) { for (int section = first; section <= last; ++section) { QCheckBox* cbox = m_lstCb[section]; cbox->setText(model()->headerData(section, orientation).toString()); // color highlight QPalette p = cbox->palette(); QColor clrBkgd = qvariant_cast<QColor>(model()->headerData(section, Qt::Horizontal, Qt::DecorationRole)); p.setColor(cbox->backgroundRole(), clrBkgd); if (clrBkgd.lightnessF() < 0.5) { p.setColor(cbox->foregroundRole(), Qt::white); } cbox->setPalette(p); cbox->setAutoFillBackground(true); } } }
OptionsDialog::OptionsDialog(MapGraphicsScene *ms, QWidget *parent) : QDialog(parent) , ui(new Ui::OptionsDialog) , m_scene(ms) { // NOTE: JUST for debugging (put here because the qDebug() output at start of MapWindow never reaches the // nc listner on the socket (socket probably isn't set up quick enough) // QSize strut(physicalDpiX() * 0.20,physicalDpiY() * 0.20); // qDebug() << "OptionsDialog: Debug: Global strut: "<<strut<<", based on:"<<physicalDpiX()<<" x "<<physicalDpiY()<<" dpi"; ui->setupUi(this); connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(applySettings())); // Setup wifi devices list QString dev = ms->currentDevice(); QStringList devices = WifiDataCollector::findWlanInterfaces(); m_deviceList = devices; // Disable on Android for now ONLY because the Qt filebrowser on Android is, well, crap. // When we get a decent filebrowser for Android, reenable this option on Android #ifndef Q_OS_ANDROID devices << "(Read from file...)"; #endif ui->wifiDevice->addItems(devices); int curIdx = devices.indexOf(dev); if(curIdx < 0) { #ifndef Q_OS_ANDROID // assume its a file ui->currentDeviceLabel->setText(dev); m_filename = dev; curIdx = devices.size() - 1; #else curIdx = 0; #endif } ui->wifiDevice->setCurrentIndex(curIdx); #ifndef Q_OS_ANDROID // TODO confirm signal name connect(ui->wifiDevice, SIGNAL(activated(int)), this, SLOT(wifiDeviceIdxChanged(int))); #endif ui->autoLocateAPs->setChecked(ms->autoGuessApLocations()); ui->guessMyLocation->setChecked(ms->showMyLocation()); MapRenderOptions renderOpts = ms->renderOpts(); ui->showReadingMarkers->setChecked(renderOpts.showReadingMarkers); QStringList renderOptions = QStringList() << "(None)" << "Radial Lines" << "Circles" << "Rectangle"; MapGraphicsScene::RenderMode rm = ms->renderMode(); ui->renderType->addItems(renderOptions); ui->renderType->setCurrentIndex((int)rm); if(rm == MapGraphicsScene::RenderRadial) { ui->renderRadialOpts->setVisible(true); ui->renderCircleOpts->setVisible(false); } else if(rm == MapGraphicsScene::RenderCircles) { ui->renderRadialOpts->setVisible(false); ui->renderCircleOpts->setVisible(true); } else { ui->renderRadialOpts->setVisible(false); ui->renderCircleOpts->setVisible(false); } connect(ui->renderType, SIGNAL(currentIndexChanged(int)), this, SLOT(renderModeChanged(int))); ui->multipleCircles->setChecked(renderOpts.multipleCircles); ui->fillCircles->setChecked(renderOpts.fillCircles); ui->circleSteps->setValue(renderOpts.radialCircleSteps); ui->levelSteps->setValue(renderOpts.radialLevelSteps); ui->angelDiff->setValue(renderOpts.radialAngleDiff); ui->levelDiff->setValue(renderOpts.radialLevelDiff); ui->lineWeight->setValue(renderOpts.radialLineWeight); QList<MapApInfo*> apList = ms->apInfo(); QVBoxLayout *vbox = new QVBoxLayout(ui->apListBox); QPushButton *btn; QHBoxLayout *hbox = new QHBoxLayout(); btn = new QPushButton("Check All"); connect(btn, SIGNAL(clicked()), this, SLOT(selectAllAp())); hbox->addWidget(btn); btn = new QPushButton("Clear All"); connect(btn, SIGNAL(clicked()), this, SLOT(clearAllAp())); hbox->addWidget(btn); vbox->addLayout(hbox); qSort(apList.begin(), apList.end(), OptionsDialog_sort_byEssid); foreach(MapApInfo *info, apList) { QCheckBox *cb = new QCheckBox(QString("%1 (%2)").arg(info->essid).arg(info->mac.right(6))); cb->setChecked(info->renderOnMap); QPalette p = cb->palette(); p.setColor(QPalette::WindowText, m_scene->baseColorForAp(info->mac).darker()); cb->setPalette(p); m_apCheckboxes[info->mac] = cb; vbox->addWidget(cb); }