GraphNode::GraphNode(Widget *parent, Graph *parentGraph, const std::string &title) : Window(parent, title), mParentGraph(parentGraph), mAnchorPos(Eigen::Vector2i::Zero()), mAnchorHeight(30), mShaderObject(nullptr) { mSize = Eigen::Vector2i(100, 80); mPopup = new DirectPopup(this, this); mPopup->setId("graphNodePopup"); mPopup->setSize(Eigen::Vector2i(10, 10)); mPopup->setLayout(new nanogui::GroupLayout()); mPopup->setVisible(false); ClickableLabel *removeButton = new ClickableLabel(mPopup, "Remove"); removeButton->setId("removeGraphNodeButton"); removeButton->setCallback([this](const Eigen::Vector2i &p) { spdlog::get("qde")->debug( "GraphNode '{}': Removing", mTitle ); mShaderSource->decTimesUsed(); // TODO: Check if this really is the proper way to delete an // object. What happens with the instance here? Graph *parentGraph = dynamic_cast<Graph *>(mParent); parentGraph->removeChild(this); mPopup->setVisible(false); }); }
void WidgetContainerOverview::addWidget(QWidget *widget) { stackedWidget->addWidget(widget); ClickableLabel *label = new ClickableLabel("", this); connect(label, SIGNAL(clicked()), this, SLOT(labelClicked())); gl->addWidget(label, labelList.count() % 2, labelList.count() / 2); labelList.append(label); // ID is the total number(sequence number) label->setProperty(idProperty, labelList.count()); }
void WidgetContainerOverview::labelClicked() { QObject *sender = QObject::sender(); ClickableLabel *label = qobject_cast<ClickableLabel *>(sender); if (label) { int stackedWidgetIndex = label->property(idProperty).toInt(); // overview widget is not count if (stackedWidget->count() - 1 < stackedWidgetIndex) return; overviewUpdateTimer->stop(); updateStackedWidget(stackedWidgetIndex); } }
void PrefsDialog::setUnconnectedColor() { QColor cc = ItemBase::unconnectedColor(); QColor scc = ItemBase::standardUnconnectedColor(); SetColorDialog setColorDialog(tr("Unconnected Highlight"), cc, scc, false, this); int result = setColorDialog.exec(); if (result == QDialog::Rejected) return; QColor c = setColorDialog.selectedColor(); m_settings.insert("unconnectedColor", c.name()); ClickableLabel * cl = qobject_cast<ClickableLabel *>(sender()); if (cl) { cl->setPalette(QPalette(c)); } }
void displayPacketDescription(PacketDescription *packet) { if (packet != NULL) { std::string name = Convert::IntToString(packet->getIndex()) + "\tIp source: " + packet->getIpSource() + "\tIp dest: " + packet->getIpDest() + "\tLength: " + Convert::IntToString(packet->getLength()) + "\tProtocol: " + packet->getProtocol(); ClickableLabel *qpacket = new ClickableLabel(name.c_str(), layout_packets_content); qpacket->setIndex(packet->getIndex()); labels.push_back(qpacket); layout_packets->addWidget(qpacket); CaptureHandler::connect(qpacket, SIGNAL(clicked()), signalMapper, SLOT(map())); signalMapper->setMapping(qpacket, count); scroller_packets->update(); } }
OverviewPage::OverviewPage(QWidget *parent, BitcoinGUI *_gui): QWidget(parent), gui(_gui), ui(new Ui::OverviewPage) { ui->setupUi(this); //#a13469 #6c3d94 ui->labelIntroText->setStyleSheet(".QLabel{color:#000000; border: 1px solid black;background-color: #C3C0BB; padding:10px;}"); ui->labelIntroText->setText("<b>Welcome to SpreadCoin, " "the project that is building a network where any possible application " "or service can be run in a decentralised manner.</b>"); #ifdef Q_OS_WIN32 ui->labelIntroText->setFixedHeight(50); #else ui->labelIntroText->setFixedHeight(60); #endif ClickableLabel *JumpSelector = new ClickableLabel();//Label(this); ClickableLabel *JumpSelector2 = new ClickableLabel(); ClickableLabel *JumpSelector3 = new ClickableLabel(); ClickableLabel *JumpSelector4 = new ClickableLabel(); JumpSelector->setStyleSheet(".ClickableLabel{background-color: #EEEEEE; border: none; border-radius: 10px; padding:10px;}"); JumpSelector2->setStyleSheet(".ClickableLabel{background-color: #EEEEEE; border: none; border-radius: 10px; padding:10px;}"); JumpSelector3->setStyleSheet(".ClickableLabel{background-color: #EEEEEE; border: none; border-radius: 10px; padding:10px;}"); JumpSelector4->setStyleSheet(".ClickableLabel{background-color: #EEEEEE; border: none; border-radius: 10px; padding:10px;}"); JumpSelector->setWordWrap(true); JumpSelector2->setWordWrap(true); JumpSelector3->setWordWrap(true); JumpSelector4->setWordWrap(true); JumpSelector->setCursor(QCursor(Qt::PointingHandCursor)); JumpSelector2->setCursor(QCursor(Qt::PointingHandCursor)); JumpSelector3->setCursor(QCursor(Qt::PointingHandCursor)); JumpSelector4->setCursor(QCursor(Qt::PointingHandCursor)); JumpSelector->setText("<span style='font-size:12pt;'><b>Wallet</b></span><br><br>" "<span style='font-size:10pt;'>Send and receive coins, view your transactions, manage your address book and backup your wallet.</span>"); JumpSelector2->setText("<span style='font-size:12pt;'><b>Vanity Gen</b></span><br><br>" "<span style='font-size:10pt;'>Create uniquely recognizable<br>SPR addresses with the in-wallet Vanity Address Generator.</span>"); JumpSelector3->setText("<span style='font-size:12pt;'><b>Mining</b></span><br><br>" "<span style='font-size:10pt;'>View<br>current and historical<br>network mining data.</span>"); JumpSelector4->setText("<span style='font-size:12pt;'><b>Settings</b></span><br><br>" "<span style='font-size:10pt;'>Change local network settings, application behaviour and <br>display options.</span>"); JumpSelector->setAlignment(Qt::AlignCenter); JumpSelector2->setAlignment(Qt::AlignCenter); JumpSelector3->setAlignment(Qt::AlignCenter); JumpSelector4->setAlignment(Qt::AlignCenter); JumpSelector->setFixedWidth(200); JumpSelector->setMinimumHeight(100); JumpSelector2->setFixedWidth(200); JumpSelector2->setMinimumHeight(100); JumpSelector3->setFixedWidth(200); JumpSelector3->setMinimumHeight(100); JumpSelector4->setFixedWidth(200); JumpSelector4->setMinimumHeight(100); ui->gridLayout->addWidget(JumpSelector,0,0,Qt::AlignCenter); ui->gridLayout->addWidget(JumpSelector2,0,1,Qt::AlignCenter); ui->gridLayout->addWidget(JumpSelector3,1,0,Qt::AlignCenter); ui->gridLayout->addWidget(JumpSelector4,1,1,Qt::AlignCenter); connect(JumpSelector, SIGNAL(clicked()), this,SLOT(gotoSendCoinsPage())); connect(JumpSelector2, SIGNAL(clicked()), this,SLOT(gotoVanityGenPage())); connect(JumpSelector3, SIGNAL(clicked()), this,SLOT(gotoMiningInfoPage())); connect(JumpSelector4, SIGNAL(clicked()), this,SLOT(gotoSettings())); ui->linkLabel1->setStyleSheet(".QLabel{color:#FFFFFF; background-color: #6c3d94; border: none; border-radius: 10px; padding:10px;}"); ui->linkLabel2->setStyleSheet(".QLabel{color:#FFFFFF; background-color: #6c3d94; border: none; border-radius: 10px; padding:10px;}"); ui->linkLabel3->setStyleSheet(".QLabel{color:#FFFFFF; background-color: #6c3d94; border: none; border-radius: 10px; padding:10px;}"); ui->linkLabel1->setOpenExternalLinks(true); ui->linkLabel2->setOpenExternalLinks(true); ui->linkLabel3->setOpenExternalLinks(true); ui->linkLabel1->setTextFormat(Qt::RichText); ui->linkLabel1->setText("<a style='text-decoration:none; ' href='http://www.spreadcoin.info'>" "<span style='font-size:12pt; font-weight:300; color:#FFFFFF;'><b>Official Website</b></span><br>" "<span style='font-size:8pt; font-weight:300; color:#FFFFFF;'>For the most up-to-date Downloads or News</span>" "</a>"); ui->linkLabel2->setText("<a style='text-decoration:none; ' href='http://www.spreadcointalk.org'>" "<span style='font-size:12pt; font-weight:300; color:#FFFFFF;'><b>Official Forum</b></span><br>" "<span style='font-size:8pt; font-weight:300; color:#FFFFFF;'>For Tutorials and Technical Support</span>" "</a>"); ui->linkLabel3->setText("<a style='text-decoration:none; ' href='https://bitcointalk.org/index.php?topic=1045373.0'>" "<span style='font-size:12pt; font-weight:300; color:#FFFFFF;'><b>Bitcointalk Forum</b></span><br>" "<span style='font-size:8pt; font-weight:300; color:#FFFFFF;'>For General Discussion</span>" "</a>"); }
QPointer<QWidget> QuBoolean::makeWidget(Questionnaire *questionnaire) { bool read_only = questionnaire->readOnly(); QPointer<QWidget> widget = new QWidget(); widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QHBoxLayout* layout = new QHBoxLayout(); widget->setLayout(layout); // To align things in a QHBoxLayout, align the widgets within the layout: // layout->setAlignment(widget, alignment) // not the layout: // layout->setAlignment(alignment) // Label QWidget* labelwidget = nullptr; if (!m_text.isEmpty() && !m_as_text_button) { // Text label if (!read_only && m_content_clickable) { ClickableLabelWordWrapWide* label = new ClickableLabelWordWrapWide(m_text); // label->setObjectName("debug_green"); connect(label, &ClickableLabelWordWrapWide::clicked, this, &QuBoolean::clicked); labelwidget = label; } else { LabelWordWrapWide* label = new LabelWordWrapWide(m_text); labelwidget = label; } int fontsize = questionnaire->fontSizePt( m_big_text ? UiConst::FontSize::Big : UiConst::FontSize::Normal); QString css = UiFunc::textCSS(fontsize, m_bold, m_italic); labelwidget->setStyleSheet(css); // needs_stretch stays false (or we'll prevent the text expanding) } else if (!m_image_filename.isEmpty()) { // Image label QPixmap image = UiFunc::getPixmap(m_image_filename, m_image_size); if (!read_only && m_content_clickable) { ClickableLabel* label = new ClickableLabel(); label->setPixmap(image); connect(label, &ClickableLabel::clicked, this, &QuBoolean::clicked); labelwidget = label; } else { QLabel* label = new QLabel(); label->setFixedSize(image.size()); label->setPixmap(image); labelwidget = label; } } // otherwise... no label, just the indicator // Indicator m_indicator = new BooleanWidget(); m_indicator->setSize(m_big_indicator); m_indicator->setReadOnly(read_only); if (m_as_text_button) { m_indicator->setAppearance(BooleanWidget::Appearance::Text); m_indicator->setText(m_text); } else { m_indicator->setAppearance(BooleanWidget::Appearance::CheckRed); } if (!read_only) { connect(m_indicator, &BooleanWidget::clicked, this, &QuBoolean::clicked); } // Whole thing if (labelwidget) { if (m_indicator_on_left) { layout->addWidget(m_indicator); layout->addWidget(labelwidget); } else { layout->addWidget(labelwidget); layout->addWidget(m_indicator); } layout->setAlignment(labelwidget, Qt::AlignVCenter); } else { // Just the indicator layout->addWidget(m_indicator); } layout->addStretch(); layout->setAlignment(m_indicator, Qt::AlignTop); setFromField(); return widget; }
PermissionsSetupPage::PermissionsSetupPage( QWidget *parent ) : QWidget( parent ) { QGridLayout * layout = new QGridLayout( this ); layout->cellRect( 1, 1 ); layout->setMargin( 0 ); layout->setSpacing( 0 ); QSpacerItem *spacer_top = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); layout->addItem( spacer_top, 0, 1 ); QSpacerItem *spacer_left = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); layout->addItem( spacer_left, 1, 0 ); // Logo QPixmap permissionsSetupPixmap ( KStandardDirs::locate( "data", "krecipes/pics/dbpermissions.png" ) ); logo = new QLabel( this ); logo->setPixmap( permissionsSetupPixmap ); logo->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); layout->addWidget( logo, 1, 1, 8, 1, Qt::AlignTop ); // Spacer to separate the logo QSpacerItem *logoSpacer = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); layout->addItem( logoSpacer, 1, 2 ); // Explanation Text permissionsText = new QLabel( this ); permissionsText->setText( i18n( "<p>This dialog will allow you to specify a MySQL account that has the necessary permissions to access the Krecipes MySQL database.</p><p><b><font size=\"+1\">Most users that use Krecipes and MySQL for the first time can just leave the default parameters and press \'Next\'.</font></b></p> <p>If you set a MySQL root password before, or you have already permissions as normal user, click on the appropriate option. Otherwise the account 'root' will be used, with no password.</p><p>[For security reasons, we strongly encourage you to setup a MySQL root password if you have not done so yet. Just type as root: mysqladmin password <i>your_password</i>]</p>" ) ); permissionsText->setWordWrap(true); permissionsText->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); permissionsText->setAlignment( Qt::AlignTop ); layout->addWidget( permissionsText, 1, 3 ); // Text spacer QSpacerItem *textSpacer = new QSpacerItem( 10, 30, QSizePolicy::Minimum, QSizePolicy::Fixed ); layout->addItem( textSpacer, 2, 3 ); // "The user already has permissions" checkbox //FIXME: We need to do a workaround to have word wrapping in QCheckBox. //see http://bugreports.qt.nokia.com/browse/QTBUG-5370 KHBox * noSetupContainer = new KHBox; noSetupCheckBox = new QCheckBox( noSetupContainer ); noSetupCheckBox->setObjectName( "noSetupCheckBox" ); noSetupCheckBox->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); ClickableLabel * noSetupLabel = new ClickableLabel( i18n( "I have already set the necessary permissions" ), noSetupContainer ); noSetupLabel->setWordWrap( true ); connect( noSetupLabel, SIGNAL(clicked()), noSetupCheckBox, SLOT(click()) ); layout->addWidget( noSetupContainer, 3, 3 ); QSpacerItem *checkBoxSpacer = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); layout->addItem( checkBoxSpacer, 4, 3 ); // root checkbox //FIXME: We need to do a workaround to have word wrapping in QCheckBox. //see http://bugreports.qt.nokia.com/browse/QTBUG-5370 KHBox * rootContainer = new KHBox; rootCheckBox = new QCheckBox( rootContainer ); rootCheckBox->setObjectName( "rootCheckBox" ); rootCheckBox->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); ClickableLabel * rootLabel = new ClickableLabel( i18n( "I have already set a MySQL root/admin account" ), rootContainer ); rootLabel->setWordWrap( true ); connect( rootLabel, SIGNAL(clicked()), rootCheckBox, SLOT(click()) ); layout->addWidget( rootContainer, 5, 3 ); QSpacerItem *rootInfoSpacer = new QSpacerItem( 10, 20, QSizePolicy::Minimum, QSizePolicy::Fixed ); layout->addItem( rootInfoSpacer, 6, 3 ); // MySQL root/admin info QGroupBox *rootInfoGBox = new QGroupBox( this ); QFormLayout *rootInfoLayout = new QFormLayout; rootInfoGBox->setTitle( i18n( "MySQL Administrator Account" ) ); rootInfoGBox->setEnabled( false ); // Disable by default // User Entry userEdit = new KLineEdit( rootInfoGBox ); userEdit->setText( "root" ); rootInfoLayout->addRow( i18nc("@label:textbox Database Username", "Username:"******"Password:" ), passEdit ); rootInfoGBox->setLayout(rootInfoLayout); layout->addWidget( rootInfoGBox, 7, 3 ); // Bottom spacer QSpacerItem *bottomSpacer = new QSpacerItem( 10, 20, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); layout->addItem( bottomSpacer, 8, 1 ); // Connect Signals & slots connect( rootCheckBox, SIGNAL( toggled( bool ) ), rootInfoGBox, SLOT( setEnabled( bool ) ) ); connect( rootCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( rootCheckBoxChanged( bool ) ) ); connect( noSetupCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( noSetupCheckBoxChanged( bool ) ) ); }