Example #1
0
int ButtonGroup::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: buttonClicked((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: buttonReleased((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: buttonPressed((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 3;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = getCheckedId(); break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: checkId(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 1;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #2
0
static LRESULT CALLBACK buttonSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR id, DWORD_PTR data)
{
	switch (uMsg) {
	case msgCOMMAND:
		if (HIWORD(wParam) == BN_CLICKED) {
			buttonClicked((void *) data);
			return 0;
		}
		return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam);
	case WM_NCDESTROY:
		if ((*fv_RemoveWindowSubclass)(hwnd, buttonSubProc, id) == FALSE)
			xpanic("error removing Button subclass (which was for its own event handler)", GetLastError());
		return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam);
	default:
		return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam);
	}
	xmissedmsg("Button", "buttonSubProc()", uMsg);
	return 0;		// unreached
}
void FancyLineEdit::iconClicked()
{
    IconButton *button = qobject_cast<IconButton *>(sender());
    int index = -1;
    for (int i = 0; i < 2; ++i)
        if (d->m_iconbutton[i] == button)
            index = i;
    if (index == -1)
        return;
    if (d->m_menu[index]) {
        execMenuAtWidget(d->m_menu[index], button);
    } else {
        emit buttonClicked((Side)index);
        if (index == Left)
            emit leftButtonClicked();
        else if (index == Right)
            emit rightButtonClicked();
    }
}
void ZmqClientProcess::send(GenericSendMessage &message, EventHandler &handler) {
    m_zmqMutex.lock();
    if (m_isAlive) {
        switch (message.type) {
        case None: {
            throw std::invalid_argument("Message type must not be 'None'");
            break;
        }
        case Track: {
            auto &m = static_cast<SendTrackMessage &>(message);
            track(m, handler);
            break;
        }
        case Paint: {
            auto &m = static_cast<SendPaintMessage &>(message);
            paint(m, handler);
            break;
        }
        case PaintOverlay: {
            auto &m = static_cast<SendPaintOverlayMessage &>(message);
            paintOverlay(m, handler);
            break;
        }
        case RequestTools: {
            auto &m = static_cast<SendRequestWidgetsMessage &>(message);
            requestTools(m, handler);
            break;
        }
        case ButtonClick: {
            auto &m = static_cast<SendButtonClickMessage &>(message);
            buttonClicked(m, handler);
            break;
        }
        case ValueChanged: {
            auto &m = static_cast<SendValueChangedMessage &>(message);
            sendValue(m, handler);
            break;
        }
        }
    }
    m_zmqMutex.unlock();
}
Example #5
0
void WSettings::loadImpl()
{
	clearItems();
	Config config(QLatin1String("weather"));
	config.beginGroup(QLatin1String("main"));
	ui.intervalBox->setValue(config.value(QLatin1String("interval"), 25));
	ui.showStatusBox->setChecked(config.value(QLatin1String("showStatus"), true));
	int index = ui.themeNameBox->findText(config.value(QLatin1String("themeName"), QString()));
	ui.themeNameBox->setCurrentIndex(qMax(0, index));
	int count = config.beginArray(QLatin1String("contacts"));
	for (int i = 0; i < count; i++) {
		config.setArrayIndex(i);
		QString cityCode = config.value(QLatin1String("code"), QString());
		QString cityName = config.value(QLatin1String("name"), QString());
		QString stateName = config.value(QLatin1String("state"), QString());
		WListItem *item = new WListItem(cityName, stateName, cityCode, ui.citiesList);
		connect(item, SIGNAL(buttonClicked()), this, SLOT(onRemoveButtonClicked()));
		m_items << item;
	}
}
Example #6
0
int MyInputPanel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: characterGenerated((*reinterpret_cast< QChar(*)>(_a[1]))); break;
        case 1: BackSpaceSignal(); break;
        case 2: EnterSignal(); break;
        case 3: saveFocusWidget((*reinterpret_cast< QWidget*(*)>(_a[1])),(*reinterpret_cast< QWidget*(*)>(_a[2]))); break;
        case 4: buttonClicked((*reinterpret_cast< QWidget*(*)>(_a[1]))); break;
        case 5: Backspace(); break;
        case 6: Enter(); break;
        default: ;
        }
        _id -= 7;
    }
    return _id;
}
Example #7
0
void TimerWidget::displayRunningTimerState(
    TimeEntryView *te) {
    ui->start->setText("Stop");

    ui->description->setEditText(te->Description);
    ui->description->setEnabled(false);

    ui->duration->setText(te->Duration);
    ui->duration->setEnabled(false);

    ui->project->setText(te->ProjectAndTaskLabel);

    duration = te->DurationInSeconds;

    disconnect(this, SLOT(start()));
    disconnect(this, SLOT(stop()));

    connect(this, SIGNAL(buttonClicked()), this, SLOT(stop()));

    timer->start(1000);
}
Example #8
0
FileEdit::FileEdit(QWidget *parent)
    : QWidget(parent)
{
    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->setMargin(0);
    layout->setSpacing(0);
    theLineEdit = new QLineEdit(this);
    theLineEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred));
    QToolButton *button = new QToolButton(this);
    button->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred));
    button->setText(QLatin1String("..."));
    layout->addWidget(theLineEdit);
    layout->addWidget(button);
    setFocusProxy(theLineEdit);
    setFocusPolicy(Qt::StrongFocus);
    setAttribute(Qt::WA_InputMethodEnabled);
    connect(theLineEdit, SIGNAL(textEdited(const QString &)),
                this, SIGNAL(filePathChanged(const QString &)));
    connect(button, SIGNAL(clicked()),
                this, SLOT(buttonClicked()));
}
Example #9
0
QStatusWidget::QStatusWidget(QWidget *parent) :
    QWidget(parent)
{

    QHBoxLayout *h=new QHBoxLayout;
    h->setContentsMargins(5,1,0,0);
    h->setSpacing(4);
    this->setLayout(h);


    QStatusButton * button;

    button=new QStatusButton(1,tr("Output"),this);
    h->addWidget(button,0,Qt::AlignLeft);
    connect(button,SIGNAL(clicked()),this,SLOT(buttonClicked()));
    m_buttons.append(button);

    h->addWidget(new QWidget,1);

    m_select=-1;
}
Example #10
0
void RKRadio::propertyChanged (RKComponentPropertyBase *property) {
	RK_TRACE (PLUGIN);

	if (updating) return;

	int new_id = -1;
	if (property == string) {
		new_id = findOption (string->value ());
	} else if (property == number) {
		new_id = number->intValue ();
	} else {
		RK_ASSERT (false);
	}

	updating = true;
	group->setButton (new_id);
	buttonClicked (new_id);		// unfortunately, this slot is not called when the option is changed programatically!
	updating = false;

	changed ();
}
Example #11
0
void CleanWidget::initUI()
{
    m_topBackWidget = new WenliBackWidget;
    m_stackStatusWidget = new StackStatusWidget;
    m_topBackWidget->insertWidget(m_stackStatusWidget);
    m_topBackWidget->setButtonInfo(":/safe/return");
    m_stackStatusWidget->setStaticIcon(":/clean/top_scan");
    m_stackStatusWidget->setNormalButton(":/clean/btn_top_scan");
    m_stackStatusWidget->setTextInfo("已选择6项清理类型", "经常清理,让电脑保持最佳状态");
    m_topBackWidget->setFixedHeight(150);
    connect(m_topBackWidget, SIGNAL(buttonClicked()), this, SIGNAL(goToMain()));
    m_scanBottomWidget = new CleanScanBottom;

    QVBoxLayout *vLayout = new QVBoxLayout;
    vLayout->addWidget(m_topBackWidget);
    vLayout->addWidget(m_scanBottomWidget);
    vLayout->setSpacing(0);
    vLayout->setContentsMargins(0,0,0,0);

    this->setLayout(vLayout);
}
Example #12
0
KWStartupWidget::KWStartupWidget(QWidget *parent, KWDocument *doc, const KoColumns &columns)
        : QWidget(parent),
        m_unit(doc->unit())
{
    widget.setupUi(this);
    m_columns = columns;
    m_layout.leftMargin = MM_TO_POINT(30);
    m_layout.rightMargin = MM_TO_POINT(30);
    m_layout.topMargin = MM_TO_POINT(25);
    m_layout.bottomMargin = MM_TO_POINT(25);
    m_doc = doc;

    setFocusProxy(widget.createButton);

    QVBoxLayout *lay = new QVBoxLayout(widget.sizeTab);
    m_sizeWidget = new KoPageLayoutWidget(widget.sizeTab, m_layout);
    m_sizeWidget->showPageSpread(true);
    m_sizeWidget->setUnit(m_unit);
    lay->addWidget(m_sizeWidget);

    lay = new QVBoxLayout(widget.columnsTab);
    m_columnsWidget = new KWDocumentColumns(widget.columnsTab, m_columns);
    m_columnsWidget->setUnit(m_unit);
    m_columnsWidget->setShowPreview(false);
    lay->addWidget(m_columnsWidget);

    lay = new QVBoxLayout(widget.previewPane);
    widget.previewPane->setLayout(lay);
    KoPagePreviewWidget *prev = new KoPagePreviewWidget(widget.previewPane);
    lay->addWidget(prev);
    prev->setColumns(columns);
    prev->setPageLayout(m_layout);

    connect(m_sizeWidget, SIGNAL(layoutChanged(KoPageLayout)), this, SLOT(sizeUpdated(KoPageLayout)));
    connect(widget.createButton, SIGNAL(clicked()), this, SLOT(buttonClicked()));
    connect(m_sizeWidget, SIGNAL(unitChanged(KoUnit)), this, SLOT(unitChanged(KoUnit)));
    connect(m_columnsWidget, SIGNAL(columnsChanged(KoColumns)), prev, SLOT(setColumns(KoColumns)));
    connect(m_columnsWidget, SIGNAL(columnsChanged(KoColumns)), this, SLOT(columnsUpdated(KoColumns)));
    connect(m_sizeWidget, SIGNAL(layoutChanged(KoPageLayout)), prev, SLOT(setPageLayout(KoPageLayout)));
}
Example #13
0
void MToolButton::allButtonPointSlot(int id)
{
    if(expandToolBar != NULL)
    {
        expandToolBar->hide();
        bExpand = false;
    }

    toolButtonGroup->button(0)->setStyleSheet(buttonCssDefaultMap[buttonIdCssMap[id]]);
    toolButtonGroup->button(0)->setToolTip(buttonTipsMap[buttonIdCssMap[id]]);
    toolButtonGroup->button(0)->setStatusTip(buttonTipsMap[buttonIdCssMap[id]]);
    int css0 = buttonIdCssMap[0];
    buttonIdCssMap[0] = buttonIdCssMap[id];
    buttonIdCssMap[id] = css0;

    QMap<int, int>::iterator i;
    for (i = buttonIdCssMap.begin(); i != buttonIdCssMap.end(); ++i)
    {
        if(i.key() != 0)
        {
            toolButtonGroup->button(i.key())->setStyleSheet(buttonCssMap[buttonIdCssMap[i.key()]]);
            toolButtonGroup->button(i.key())->setToolTip(buttonTipsMap[buttonIdCssMap[i.key()]]);
            toolButtonGroup->button(i.key())->setStatusTip(buttonTipsMap[buttonIdCssMap[i.key()]]);

        }
    }

    nState = buttonIdCssMap[0];
    if(!bCommon)
    {
        setDown(true);
        bPress = true;
    }

    emit buttonClicked(nState);
    if(!bCommon)
    {
        emit buttonClickedList(this);
    }
}
// handle the system menu
void Controller::handleMenu(int menuId) {
  int fontSize = _output->getFontSize();
  _systemMenu = false;

  switch (menuId) {
  case MENU_SOURCE:
    showSystemScreen(true);
    break;
  case MENU_CONSOLE:
    showSystemScreen(false);
    break;
  case MENU_KEYPAD:
    maShowVirtualKeyboard();
    break;
  case MENU_ZOOM_UP:
    if (_fontScale > FONT_MIN) {
      _fontScale -= FONT_SCALE_INTERVAL;
      fontSize = (_initialFontSize * _fontScale / 100);
    }
    break;
  case MENU_ZOOM_DN:
    if (_fontScale < FONT_MAX) {
      _fontScale += FONT_SCALE_INTERVAL;
      fontSize = (_initialFontSize * _fontScale / 100);
    }
    break;
  }

  if (fontSize != _output->getFontSize()) {
    _output->setFontSize(fontSize);
    // restart the shell
    buttonClicked("main.bas");
    brun_break();
    _runMode = break_state;
  }
  
  if (!isRunning()) {
    _output->flush(true);
  }
}
Example #15
0
void SafeWidget::initUI()
{
    m_topBackWidget = new WenliBackWidget;
    m_stackStatusWidget = new StackStatusWidget;
    m_topBackWidget->insertWidget(m_stackStatusWidget);
    m_topBackWidget->setButtonInfo(":/safe/return");
    m_stackStatusWidget->setStaticIcon(":/safe/logo_normal");
    m_stackStatusWidget->setNormalButton(":/safe/start");
    m_stackStatusWidget->setTextInfo("安全扫描", "谢谢使用");
    m_topBackWidget->setFixedHeight(150);
    connect(m_topBackWidget, SIGNAL(buttonClicked()), this, SIGNAL(goToMain()));
    m_scanBottomWidget = new SafeScanBottom;

    QVBoxLayout *vLayout = new QVBoxLayout;
    vLayout->addWidget(m_topBackWidget);
    vLayout->addWidget(m_scanBottomWidget);
    vLayout->setSpacing(0);
    vLayout->setContentsMargins(0,0,0,0);

    this->setLayout(vLayout);

}
Example #16
0
ComboButton::ComboButton( QWidget *parent )
    : QWidget( parent )
{
    m_increaseHeight = 0;

    QGridLayout *grid = new QGridLayout( this );
    grid->setContentsMargins( 0, 0, 0, 0 );

    m_box = new KComboBox( this );
    grid->addWidget( m_box, 0, 0 );
    connect( m_box, SIGNAL(activated(int)), this, SLOT(boxActivated(int)) );
    setFocusProxy( m_box );

    m_button = new KPushButton( QString(), this );
    grid->addWidget( m_button, 0, 0 );
    connect( m_button, SIGNAL(clicked()), this, SLOT(buttonClicked()) );
    m_iconHight = m_button->iconSize().height();

//     m_sizeMode = Max;

    balanceSize();
}
Example #17
0
Cookie::Cookie(QWidget *parent) :
    QWidget(parent),
    settingsFile(QLatin1String("config.ini")),ui(new Ui::cookie)
{
    qDebug() << __PRETTY_FUNCTION__ << " called ...";

    ui->setupUi(this);
    this->loadSettings();

    this->ui->CustomCookieRules_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);

    QAction*    action_addCookieCustomCookieRule = new QAction(tr("Add custom cookie rule ..."),this->ui->CustomCookieRules_treeWidget);
    connect(action_addCookieCustomCookieRule,SIGNAL(triggered()),this,SLOT(addCookieRule()));
    this->ui->CustomCookieRules_treeWidget->addAction(action_addCookieCustomCookieRule);
    connect(this->ui->AddCustomCookieRule_pushButton,SIGNAL(clicked()),this,SLOT(addCookieRule()));

    QAction*    action_removeCustomCookieRule = new QAction(tr("Remove custom cookie rule ..."),this->ui->CustomCookieRules_treeWidget);
    connect(action_removeCustomCookieRule,SIGNAL(triggered()),this,SLOT(removeCustomCookieRule()));
    this->ui->CustomCookieRules_treeWidget->addAction(action_removeCustomCookieRule);
    connect(this->ui->RemoveCustomCookieRule_pushButton,SIGNAL(clicked()),this,SLOT(removeCustomCookieRule()));

    QAction*    action_moveCustomCookieRuleUp = new QAction(tr("Move custom cookie rule up ..."),this->ui->CustomCookieRules_treeWidget);
    connect(action_moveCustomCookieRuleUp,SIGNAL(triggered()),this,SLOT(moveCookieRuleUp()));
    this->ui->CustomCookieRules_treeWidget->addAction(action_moveCustomCookieRuleUp);
    connect(this->ui->MoveUpCustomCookieRule_pushButton,SIGNAL(clicked()),this,SLOT(moveCookieRuleUp()));

    QAction*    action_moveCustomCookieRuleDown = new QAction(tr("Move custom cookie rule down ..."),this->ui->CustomCookieRules_treeWidget);
    connect(action_moveCustomCookieRuleDown,SIGNAL(triggered()),this,SLOT(moveCookieRuleDown()));
    this->ui->CustomCookieRules_treeWidget->addAction(action_moveCustomCookieRuleDown);
    connect(this->ui->MoveDownCustomCookieRule_pushButton,SIGNAL(clicked()),this,SLOT(moveCookieRuleDown()));

    CookieViewDelegate*    CookieDelegate = new CookieViewDelegate(this);
    this->ui->CustomCookieRules_treeWidget->setItemDelegate(CookieDelegate);
    connect(CookieDelegate,SIGNAL(buttonClicked(QModelIndex)),this,SLOT(allowDenyCookie(QModelIndex)));
    this->ui->CustomCookieRules_treeWidget->header()->setSortIndicatorShown(true);

    this->ui->CustomCookieRules_treeWidget->header()->setSectionsClickable(true);
    connect(this->ui->CustomCookieRules_treeWidget->header(),SIGNAL(sectionClicked(int)),this->ui->CustomCookieRules_treeWidget,SLOT(customSortByColumn(int)));
}
Example #18
0
YouTubeWidget::YouTubeWidget(const QRectF &rect) :
     ScrollWidget(rect)
{
    mSearchButton = new PlexyDesk::Button(this);
    mSearchButton->show();
    mSearchButton->setPos(rect.width() - 110 , rect.height() - 40);

    connect(mSearchButton, SIGNAL(clicked()), this, SLOT(buttonClicked()));

    setContentRect(rect);

    this->enableDefaultBackground(true);
    //this->enableShadow(false);

    mSearchButton->setLabel("Search");

    mLineEdit = new PlexyDesk::LineEdit(this);
    mLineEdit->show();
    mLineEdit->setSize(QSizeF(rect.width() - mSearchButton->boundingRect().width(), 30));
    mLineEdit->setPos(10 , rect.height() - 40);

}
Example #19
0
AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){
  QVBoxLayout *lay = new QVBoxLayout();
  this->setLayout(lay);
    lay->setContentsMargins(0,0,0,0);
  button = new QToolButton(this);
    button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    button->setIconSize(QSize(64,64));
    button->setAutoRaise(true);
    button->setText("..."); //Need to set something here so that initial sizing works properly
  lay->addWidget(button, 0, Qt::AlignCenter);
	connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) );
  this->setInitialSize(64,66+this->fontMetrics().height());
  /*if(this->settings->allKeys().isEmpty()){
    //Brand new plugin: set initial size
    this->settings->setValue("location/width",64);
    this->settings->setValue("location/height",66+this->fontMetrics().height());
    this->settings->sync();
  }*/
  watcher = new QFileSystemWatcher(this);
	connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT( loadButton()) );
  QTimer::singleShot(1,this, SLOT(loadButton()) );
}
Example #20
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SearchLineEdit::iconClicked()
{
  IconButton* button = qobject_cast<IconButton*>(sender());
  int index = -1;
  for (int i = 0; i < 2; ++i)
    if (d->m_IconButtons[i] == button)
    { index = i; }
  if (index == -1)
  { return; }
  if (d->m_ButtonMenus[index])
  {
    execMenuAtWidget(d->m_ButtonMenus[index], button);
  }
  else
  {
    emit buttonClicked((Side)index);
    if (index == Left)
    { emit leftButtonClicked(); }
    else if (index == Right)
    { emit rightButtonClicked(); }
  }
}
Example #21
0
TicTacGameBoard::TicTacGameBoard( int n, QWidget *parent, const char *name )
    : QWidget( parent, name )
{
    st = Init;					// initial state
    nBoard = n;
    n *= n;					// make square
    comp_starts = FALSE;			// human starts
    buttons = new TicTacButtons(n);		// create real buttons
    btArray = new TicTacArray(n);		// create button model
    QGridLayout * grid = new QGridLayout( this, 3, 3, 4 );
    QPalette p( blue );
    for ( int i=0; i<n; i++ ) {			// create and connect buttons
	TicTacButton *ttb = new TicTacButton( this );
	ttb->setPalette( p );
	ttb->setEnabled( FALSE );
	connect( ttb, SIGNAL(clicked()), SLOT(buttonClicked()) );
	grid->addWidget( ttb, i%3, i/3 );
	buttons->insert( i, ttb );
	btArray->at(i) = TicTacButton::Blank;	// initial button type
    }
    QTime t = QTime::currentTime();		// set random seed
    srand( t.hour()*12+t.minute()*60+t.second()*60 );
}
void AsemanNativeNotificationItem::setActions(const QStringList &actions)
{
    for(int i=0; i<p->btns_layout->count(); i++)
        delete p->btns_layout->takeAt(i);

    for(int i=1 ;i<actions.count(); i+=2)
    {
        const QString &action = actions.at(i-1);
        const QString &text = actions.at(i);

        QPushButton *btn = new QPushButton();
        btn->setText(text);

        p->actions.insert(btn, action);
        p->buttons << btn;

        p->btns_layout->addWidget(btn);

        connect(btn, SIGNAL(clicked()), SLOT(buttonClicked()) );
    }

    p->body_layout->addStretch();
}
Example #23
0
AboutDialog::AboutDialog(QWidget* parent)
    : QDialog(parent),
      ui(new Ui::AboutDialog)
{
    setAttribute(Qt::WA_DeleteOnClose);

    ui->setupUi(this);
#ifdef Q_OS_WIN
    if (QtWin::isCompositionEnabled()) {
        QtWin::extendFrameIntoClientArea(this);
        ui->verticalLayout->setContentsMargins(0, 0, 0, 0);
    }
#endif

    connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close()));
    connect(ui->authorsButton, SIGNAL(clicked()), this, SLOT(buttonClicked()));

    showAbout();

#ifdef Q_OS_WIN
    resize(300, height());
#endif
}
Example #24
0
MainWindow::MainWindow()
  :windowLayout       (new QVBoxLayout)
  ,display            (new QLineEdit("0"))
  ,buttonContainer    (new QWidget)
  ,buttonLayout       (new QGridLayout)
  ,operations         ("+-*/=")
  ,nextInput          (false)
  ,displayNeedsCleanup(true)
  ,previouslyEqPressed(false)
{
  display->setReadOnly(true);
  display->setAlignment(Qt::AlignRight);
  windowLayout->addWidget(display);

  const int buttonRows = 4;
  const int buttonCols = 4;
  QString ButtonStrings[] = {"7","8","9","/",
                             "4","5","6","*",
                             "1","2","3","-",
                             "0",".","=","+"};

  int k = 0;
  for(int i = 0; i < buttonRows; i++)
  {
    for (int j = 0; j < buttonCols; j++)
    {
      QPushButton* button = new QPushButton(ButtonStrings [k]);
      connect(button, SIGNAL (released()), this, SLOT (buttonClicked()));
      buttonLayout->addWidget(button, i, j);
      k++;
    }
  }

  buttonContainer->setLayout(buttonLayout);
  windowLayout->addWidget(buttonContainer);
  this->setLayout(windowLayout);
}
Example #25
0
void TimerWidget::displayRunningTimerState(
    TimeEntryView *te) {
    ui->start->setText("Stop");
    ui->start->setStyleSheet(
        "background-color: #e20000; color:'white'; font-weight: bold;");

    QString description = (te->Description.length() > 0) ?
                          te->Description : "(no description)";

    ui->description->setEditText(description);
    ui->description->setEnabled(false);

    ui->duration->setText(te->Duration);
    ui->duration->setEnabled(false);

    ui->project->setText(te->ProjectAndTaskLabel);

    duration = te->DurationInSeconds;

    if (te->Description.length() > 0) {
        ui->description->setToolTip(
            QString("<p style='color:white;background-color:black;'>" +
                    te->Description+"</p>"));
    }
    if (te->ProjectAndTaskLabel.length() > 0) {
        ui->project->setToolTip(
            QString("<p style='color:white;background-color:black;'>" +
                    te->ProjectAndTaskLabel+"</p>"));
    }

    disconnect(this, SLOT(start()));
    disconnect(this, SLOT(stop()));

    connect(this, SIGNAL(buttonClicked()), this, SLOT(stop()));

    timer->start(1000);
}
bool RosterItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *, const QStyleOptionViewItem &option, const QModelIndex &index)
{
    if( event->type() == QEvent::MouseButtonPress ||
        event->type() == QEvent::MouseButtonRelease ) {
    } else {
        return false;
    }

    QRect buttonRect( option.rect);
    buttonRect.setY(option.rect.y() + 20);
    buttonRect.setX(option.rect.x() + 330);
    buttonRect.setHeight(30);

    QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
    if( !buttonRect.contains( mouseEvent->pos()) ) {
        return false;
    }

    if( event->type() == QEvent::MouseButtonPress) {
    } else if( event->type() == QEvent::MouseButtonRelease) {
        emit buttonClicked(index);
    }
    return false;
}
Example #27
0
KeyboardDialog::KeyboardDialog(const QString &text,
                               enum QLineEdit::EchoMode echoMode,
                               QWidget *parent) :
    QDialog(parent),
    ui(new Ui::KeyboardDialog),
    m_modNumbers(false),
    m_shift(false)
{
    ui->setupUi(this);
    setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);

    this->setStyleSheet(DARK_BUTTONS_STYLE);

    ui->lineEdit->setEchoMode(echoMode);

    if (echoMode == QLineEdit::Password) {
        m_modNumbers = true;
    }

    if (text.isEmpty()) {
        ui->lineEdit->clear();
    } else {
        ui->lineEdit->setText(text);
    }

    changeLayout(m_modNumbers, m_shift);
    QPushButton *btn;
    for (int i = 0; i < SOFTKEYS; i++) {
        btn = findChild<QPushButton *>(QString("btn_%1").arg(i));
        if (btn) {
            connect(btn, SIGNAL(clicked()), this, SLOT(buttonClicked()));
            connect(btn, SIGNAL(pressed()), this, SLOT(buttonPressed()));
            connect(btn, SIGNAL(released()), this, SLOT(buttonReleased()));
        }
    }
}
Example #28
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QPalette palWhite;
    palWhite.setColor(  ui->LeftWidget->backgroundRole(), Qt::white);
    ui->LeftWidget->setPalette( palWhite);
    ui->LeftWidget->setAutoFillBackground(true);
    ui->RightWidget->setPalette(palWhite);
    ui->RightWidget->setAutoFillBackground(true);

    controller = new Controller(ui->LeftWidget, ui->RightWidget);

//   QObject::connect( ui->LeftWidget, SIGNAL(DotCreated(QPoint)),
//                      controller, SLOT(controleLeftWidget(QPoint)));
    QObject::connect( ui->LeftWidget, SIGNAL(DotCreated(QPoint)),
                       controller, SLOT(addDotToLeftWidget(QPoint)));

    QObject::connect( ui->RightWidget, SIGNAL(DotCreated(QPoint)),
                      controller, SLOT(addDotToRightWidget(QPoint)));

    QObject::connect(ui->pushButton,  SIGNAL(clicked()),
                     controller, SLOT(buttonClicked()));
    QObject::connect(ui->pushButton_2, SIGNAL(clicked()),
                     controller, SLOT(clearDrawingPlace()));

    QObject::connect(ui->LeftWidget, SIGNAL(mouseMove(QPoint)),
                     controller, SLOT(lengthBetweenMouseAndContour(QPoint)));

    QObject::connect(controller, SIGNAL(changeLabel(QString)),
                     ui->label, SLOT(setText(QString)));

    QObject::connect(ui->doubleSpinBox, SIGNAL(valueChanged(double)),
                     controller, SLOT(epsChanged(double)));
}
Example #29
0
void TimerWidget::displayStoppedTimerState() {
    ui->start->setText("Start");

    if (!ui->description->hasFocus()) {
        ui->description->setEditText(descriptionPlaceholder);
    }
    ui->description->setEnabled(true);

    if (!ui->duration->hasFocus()) {
        ui->duration->setText("");
    }
    ui->duration->setEnabled(true);

    ui->project->setText("");

    duration = 0;

    disconnect(this, SLOT(start()));
    disconnect(this, SLOT(stop()));

    connect(this, SIGNAL(buttonClicked()), this, SLOT(start()));

    timer->stop();
}
Example #30
0
ColourButton::ColourButton( QWidget *pParent ) :
	QPushButton( pParent )
{
	connect( this, SIGNAL(clicked()), this, SLOT(buttonClicked()) );
}