int main(int argc, char *argv[]) { QApplication app(argc,argv); Setting settings; settings.setGeometry( 100, 100, 200, 120 ); app.setActiveWindow(&settings); settings.show(); return app.exec(); }
void PlainText::enterListWidget(int row) { if (row < listWidget->count() && row >= 0) { if ((*val)[row].icon == INTERNETICON) try { std::shared_ptr<ConfigParse> C(new ConfigParse(URLPATH)); auto tmp = C->getSections(); if (std::find(tmp.begin(), tmp.end(), (*val)[row].text) == tmp.end()){ std::ofstream out(URLPATH, std::ios::app); out << '[' << (*val)[row].text << ']' << std::endl; } }catch(...) { std::ofstream out(URLPATH, std::ios::app); out << '[' << (*val)[row].text << ']' << std::endl; } if ((*val)[row].command == "copy") { QClipboard* clipboard = QGuiApplication::clipboard(); this->parent->hide(); clipboard->setText(QString::fromStdString((*val)[row].text), QClipboard::Clipboard); clipboard->setText(QString::fromStdString((*val)[row].text), QClipboard::Selection); return; } if ((*val)[row].command == "setting") { Setting * s = new Setting; s->show(); return; } if ((*val)[row].command == "complete") { int pos = (*val)[row].text.size(); this->setPlainText(QString::fromStdString((*val)[row].text + ' ')); QTextCursor t(this->document()); t.setPosition(pos + 1); this->setTextCursor(t); return; } if ((*val)[row].command == "miss") { return; } this->parent->hide(); if (!(*val)[row].command.empty()) { QProcess::startDetached(QString::fromStdString((*val)[row].command)); fparse.addValue((*val)[row].text, 1); fparse.storeValue(); } } }