void STClearButtonView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){ if(m_drag){ m_drag=false; relayout(); ungrabMouse(); if(m_hover){ emit activated(); } } }
void MainWindow::showLabels() { G_displayel = showLabelsAct->isChecked(); if (G_displayel) { showLabelsAct->setIcon(QIcon(":/images/labelEdgesDown.png")); } else { showLabelsAct->setIcon(QIcon(":/images/labelEdges.png")); } relayout(); canvas->viewport()->update(); }
void QuickLaunchLayout::swapButtons(QuickLaunchButton * b1, QuickLaunchButton *b2) { int tmp1 = indexOf(b1); int tmp2 = indexOf(b2); if (tmp1 != tmp2) { m_buttons.swap(tmp1, tmp2); relayout(); } }
void AddNewTorrentDialog::onSavePathChanged(int index) { // Toggle default save path setting checkbox visibility ui->default_save_path_cb->setChecked(false); ui->default_save_path_cb->setVisible(QDir(ui->save_path_combo->itemData(ui->save_path_combo->currentIndex()).toString()) != QDir(Preferences::instance()->getSavePath())); relayout(); // Remember index m_oldIndex = index; updateDiskSpaceLabel(); }
void KSlider::init() { Q_D(KSlider); setAcceptedMouseButtons(Qt::LeftButton); setAcceptHoverEvents(true); setDragPolicy(Nothing); d->m_frame = new KFrameItem(":/image/theme/hslider_bkg.png", KFrameItem::GridFour, this); d->m_select = new KFrameItem(":/image/theme/slider_select.png", KFrameItem::GridFour, this); d->m_thumb = new KFrameItem(":/image/theme/hsliderthumb_normal.png|:/image/theme/hsliderthumb_hover.png|:/image/theme/hsliderthumb_down.png", KFrameItem::GridFour, this); relayout(); }
void STClearButtonView::setText(const QString &text){ if(text.startsWith(":")){ QPixmap pix; if(!QPixmapCache::find(text, &pix)){ pix.load(text); QPixmapCache::insert(text, pix); } m_item->setPixmap(pix); relayout(); }else{ // TODO: text } }
void QxtConfigWidgetPrivate::init(QxtConfigWidget::IconPosition position) { QxtConfigWidget* p = &qxt_p(); splitter = new QSplitter(p); stack = new QStackedWidget(p); table = new QxtConfigTableWidget(p); pos = position; QObject::connect(table, SIGNAL(currentCellChanged(int, int, int, int)), this, SLOT(setCurrentIndex(int, int))); QObject::connect(stack, SIGNAL(currentChanged(int)), p, SIGNAL(currentIndexChanged(int))); QVBoxLayout* layout = new QVBoxLayout(p); layout->addWidget(splitter); initTable(); relayout(); }
void LayoutSwitcher::addWidget( QWidget *e, bool r, int at) { if (_verbose) kdDebug(155003) << "LayoutSwitcher: " << _widget->name() << " " << e->name() << endl; if (e == _widget) { if (_verbose) kdDebug(155003) << ("LayoutSwitcher[%s]::addWidget() Attempting to add widget %s to itself!\n", _widget->name(), e->name()); return; } if (e->parentWidget() != _widget) { if (_verbose) printf("\te->parentWidget: %s != _widget: %s\treparenting\n", e->parentWidget() ? e->parentWidget()->name() : "0L", _widget->name()); e->reparent(_widget, QPoint(0, 0), false); } if (at == -1) { if (_verbose) { printf("\tAppending widget to end of stack\n"); } _layoutItems.append(e); } else { if (_verbose) { printf("\tInserting widget to position %d in stack\n", at); } _layoutItems.insert(at, e); } e->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); if (r) { kdDebug(155003) << "Laying out contents\n"; relayout(); } }
void KColorPopup::keyPressEvent(QKeyEvent *event) { int column = m_selectedColumn; int row = m_selectedRow; int columnCount = m_selector->columnCount(); int rowCount = m_selector->rowCount(); switch (event->key()) { case Qt::Key_Right: if (m_selectedRow != rowCount) // A normal row: column = (column + 1) % columnCount; else { // The last row, if there are two choices, switch. Else, do nothing: if (m_selector->defaultColor().isValid()) column = (m_selectedColumn < m_columnOther ? m_columnOther : 0); } break; case Qt::Key_Left: if (m_selectedRow != rowCount) { // A normal row: column = (column - 1); if (column < 0) column = columnCount - 1; } else { // The last row, if there are two choices, switch. Else, do nothing: if (m_selector->defaultColor().isValid()) column = (m_selectedColumn < m_columnOther ? m_columnOther : 0); } break; case Qt::Key_Up: row = (row - 1); if (row < 0) row = rowCount; break; case Qt::Key_Down: row = (row + 1) % (rowCount+1); break; case Qt::Key_PageDown: row += 10; if (row > rowCount) row = rowCount; break; case Qt::Key_PageUp: row -= 10; if (row < 0) row = 0; break; case Qt::Key_Home: row = 0; column = 0; break; case Qt::Key_End: row = rowCount; column = columnCount - 1; break; case Qt::Key_Return: validate(); break; default: QWidget::keyPressEvent(event); } if (row != m_selectedRow || column != m_selectedColumn) { m_selectedRow = row; m_selectedColumn = column; relayout(); update(); } }
int QToolBox::insertItem( int index, QWidget *item, const QIconSet &iconSet, const QString &label ) { if ( !item ) return -1; connect(item, SIGNAL(destroyed(QObject*)), this, SLOT(itemDestroyed(QObject*))); QToolBoxPrivate::Page c; c.widget = item; c.button = new QToolBoxButton( this, label.latin1() ); connect( c.button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); c.sv = new QScrollView( this ); c.sv->hide(); c.sv->setResizePolicy( QScrollView::AutoOneFit ); c.sv->addChild( item ); c.sv->setFrameStyle( QFrame::NoFrame ); c.setTextLabel( label ); c.setIconSet( iconSet ); if ( index < 0 || index >= (int)d->pageList.count() ) { index = (int)d->pageList.count(); d->pageList.append( c ); d->layout->addWidget( c.button ); d->layout->addWidget( c.sv ); if ( index == 0 ) setCurrentIndex( index ); } else { d->pageList.insert( d->pageList.at(index), c ); relayout(); if (d->currentPage) { QWidget *current = d->currentPage->widget; int oldindex = indexOf(current); if ( index <= oldindex ) { d->currentPage = 0; // trigger change setCurrentIndex(oldindex); } } } c.button->show(); d->updateTabs(); itemInserted(index); return index; }
void CCProgressHUD::setIcon(cocos2d::CCSprite* icon) { if(m_icon) { m_icon->removeFromParent(); CC_SAFE_RELEASE(m_icon); m_icon = NULL; } m_icon = icon; CC_SAFE_RETAIN(m_icon); if(m_icon) { m_indicator->removeFromParent(); addChild(m_icon); } else { addChild(m_indicator); } relayout(); }
ObjectGUIContainer(const std::string &objectName, const std::weak_ptr<ModuleLoader> &module) : _objectPath("/mp_objects/" + objectName), _objectName(std::make_shared<Button>(objectName)), _loadingText(std::make_shared<DebugObjectLoadingState::GrowableLabel>("Not Loaded")), _module(module) { _objectName->setSize(250, 30); addComponent(_objectName); addComponent(_loadingText); const int SCREEN_WIDTH = _gameEngine->getUIManager()->getScreenWidth(); setSize(SCREEN_WIDTH - 50, 30); _loadingText->setWidth(SCREEN_WIDTH - 50 - 265); relayout(); }
void XProcessTablePrivate::removeItemByPid(uint32_t pid) { for(int i = 0;i < _items.size();i++) { // we don't need to release the item memory , // because the item is allocated outside of the table // so it will be released by the outside allocator XProcessItem* item = _items[i]; if(item->pid() == pid) { _items.removeAt(i); relayout(); return; } } }
void KColorPopup::mouseMoveEvent(QMouseEvent *event) { int x = event->pos().x(); int y = event->pos().y(); if (x < FRAME_WIDTH + 2 || y < FRAME_WIDTH + 2 || x > width() - 2 - 2*FRAME_WIDTH || y > height() - 2 - 2*FRAME_WIDTH) return; int colorHeight = m_selector->colorRectHeight(); int colorWidth = m_selector->colorRectWidthForHeight(colorHeight); // int oldSelectedColumn = m_selectedColumn; // int oldSelectedRow = m_selectedRow; m_selectedColumn = (x - FRAME_WIDTH - MARGIN + 2) / (colorWidth + MARGIN); m_selectedRow = (y - FRAME_WIDTH - MARGIN + 2) / (colorHeight + MARGIN); relayout(); update(); }
// 'Fl_FileBrowser::up()' - Up one directory, and load it void Fl_File_Browser::up() { if(directory().empty()) return; Fl_String dir(directory()); // Remove last slash dir[dir.length()-1] = '\0'; int pos = dir.rpos(slash); if(pos==-1) dir=""; else dir = dir.sub_str(0, pos+1); load(dir); resetup(); relayout(); redraw(); parent()->relayout(); parent()->redraw(); }
Overlay::Overlay(QWidget* parent) : QLabel(parent) { d.button = 0; setVisible(false); setEnabled(false); setAutoFillBackground(true); setAlignment(Qt::AlignCenter); setAttribute(Qt::WA_TransparentForMouseEvents); QPalette pal = palette(); QColor col = pal.color(QPalette::Window); col.setAlpha(100); pal.setColor(QPalette::Window, col); setPalette(pal); parent->installEventFilter(this); relayout(); }
void VMdEditor::beginEdit() { updateConfig(); initInitImages(); setModified(false); setReadOnlyAndHighlightCurrentLine(false); emit statusChanged(); if (m_freshEdit) { m_mdHighlighter->updateHighlight(); relayout(); } else { updateHeaders(m_mdHighlighter->getHeaderRegions()); } }
void view_destroyed(tw_handle view) { debug_log("starting destroy view\n"); tw_handle output, pview; Layout *layout; //routine: //0): find out the most previous view, I think i3 has a stack that stores all the views you have output = wlc_view_get_output(view); layout = tw_output_get_current_layout(output); //TODO: we need to come up with a constant value for next view pview = layout->getViewOffset(view, 1);//get next view that may comes avaliable layout->destroyView(view); //call update view here so we don't need to call in every subclass layout->update_views(); wlc_view_focus(pview); relayout(wlc_view_get_output(view)); }
void STUserProfileView::setUser(STObjectManager::UserRef user){ m_user=user; { QLocale loc=QLocale::system(); QVariantMap data; { QMutexLocker locker(&(user->mutex)); data=user->data; } m_followersView->setNumberText(loc.toString(data["followers_count"].toULongLong())); m_friendsView->setNumberText(loc.toString(data["friends_count"].toULongLong())); m_tweetsView->setNumberText(loc.toString(data["statuses_count"].toULongLong())); m_favoritesView->setNumberText(loc.toString(data["favourites_count"].toULongLong())); m_listedView->setNumberText(loc.toString(data["listed_count"].toULongLong())); } m_lastWidth=0; relayout(); }
void Overlay::setRefresh(bool enabled) { if (enabled) { if (!d.button) { d.button = new QToolButton(parentWidget()); d.button->setObjectName("reconnectButton"); d.button->setFixedSize(32, 32); connect(d.button, SIGNAL(clicked()), this, SIGNAL(refresh())); relayout(); } d.button->show(); } else { if (d.button) d.button->deleteLater(); d.button = 0; } }
void TaskBar::update() { Fl_WM::clear_handled(); int n; // Delete all icons: for(n=0; n<children(); n++) { Fl_Image *i = child(n)->image(); if(i!=&default_icon) delete i; } clear(); Window *wins=0; int num_windows = Fl_WM::get_windows_mapping(wins); if(num_windows<=0) return; Fl_Int_List winlist; int current_workspace = Fl_WM::get_current_workspace(); for(n=0; n<num_windows; n++) { if(current_workspace == Fl_WM::get_window_desktop(wins[n]) && GetState(wins[n])>0) winlist.append(wins[n]); } if(winlist.size()>0) { for(n=0; n<(int)winlist.size(); n++) { add_new_task(winlist[n]); } } delete []wins; relayout(); redraw(); parent()->redraw(); }
bool CCProgressHUD::initWithMessage(const string& message) { if(!CCLayerColor::initWithColor(m_dimColor)) { return false; } // set message m_message = message; // create label m_msgLabel = CCLabelTTF::create(m_message.c_str(), "Helvetica", 28 / CC_CONTENT_SCALE_FACTOR()); // indicator CCImage* image = new CCImage(); image->initWithImageData((void*)s_spinner_png, 1043); CCTexture2D* tex = new CCTexture2D(); tex->initWithImage(image); m_indicator = CCSprite::createWithTexture(tex); CC_SAFE_RETAIN(m_indicator); CC_SAFE_RELEASE(image); CC_SAFE_RELEASE(tex); // layout relayout(); addChild(m_indicator); addChild(m_msgLabel); // enable event setTouchEnabled(true); setTouchMode(kCCTouchesOneByOne); setTouchPriority(-MAX_INT); setKeypadEnabled(true); // schedule update scheduleUpdate(); return true; }
LRESULT CALLBACK SimpleWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_SIZE: relayout(hWnd); break; case WM_COMMAND: switch (LOWORD(wParam)){ case BTN_ADD_NOTE:_addNode(); break; case BTN_DEL_NOTE:_delNote(); break; } break; case WM_CREATE: _windowCreated(hWnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
void DocumentListModel::setFilter(DocumentListModel::DocumentType newFilter) { m_filter = newFilter; relayout(); emit filterChanged(); }
void CCProgressHUD::setMessage(const string& msg) { m_message = msg; m_msgLabel->setString(msg.c_str()); relayout(); }
void DebugObjectLoadingState::GrowableLabel::doParentRelayout() { auto myGUIContainer = dynamic_cast<ObjectGUIContainer *>(getParent()); if (!myGUIContainer) return; myGUIContainer->relayout(); }
bool EditorCompletion::doArgumentHint( bool useIndex ) { Q3TextCursor *cursor = curEditor->textCursor(); int i = cursor->index() ; if ( !useIndex ) { bool foundParen = false; int closeParens = 0; while ( i >= 0 ) { if ( cursor->paragraph()->at( i )->c == ')' && i != cursor->index() ) closeParens++; if ( cursor->paragraph()->at( i )->c == '(' ) { closeParens--; if ( closeParens == -1 ) { foundParen = true; break; } } --i; } if ( !foundParen ) return false; } int j = i - 1; bool foundSpace = false; bool foundNonSpace = false; while ( j >= 0 ) { if ( foundNonSpace && ( cursor->paragraph()->at( j )->c == ' ' || cursor->paragraph()->at( j )->c == ',' ) ) { foundSpace = true; break; } if ( !foundNonSpace && ( cursor->paragraph()->at( j )->c != ' ' || cursor->paragraph()->at( j )->c != ',' ) ) foundNonSpace = true; --j; } if ( foundSpace ) ++j; j = qMax( j, 0 ); QString function( cursor->paragraph()->string()->toString().mid( j, i - j + 1 ) ); QString part = cursor->paragraph()->string()->toString().mid( j, cursor->index() - j + 1 ); function = function.simplified(); for (;;) { if (function.isEmpty()) return false; if ( function[ (int)function.length() - 1 ] == '(' ) { function.remove( function.length() - 1, 1 ); function = function.simplified(); } else if ( function[ (int)function.length() - 1 ] == ')' ) { function.remove( function.length() - 1, 1 ); function = function.simplified(); } else { break; } } QChar sep; QString pre, post; QList<QStringList> argl = functionParameters( function, sep, pre, post ); if ( argl.isEmpty() ) return false; QString label; int w = 0; int num = 0; if ( !functionLabel->isVisible() ) functionLabel->setNumFunctions( argl.count() ); for ( QList<QStringList>::Iterator vit = argl.begin(); vit != argl.end(); ++vit, ++num ) { QStringList args = *vit; int argNum = 0; int inParen = 0; for ( int k = 0; k < (int)part.length(); ++k ) { if ( part[ k ] == sep && inParen < 2 ) argNum++; if ( part[ k ] == '(' ) inParen++; if ( part[ k ] == ')' ) inParen--; } QString func = function; int pnt = -1; pnt = func.lastIndexOf( '.' ); if ( pnt == -1 ) func.lastIndexOf( '>' ); if ( pnt != -1 ) func = func.mid( pnt + 1 ); QString s = func + "( "; if ( s[ 0 ] == '\"' ) s.remove( (uint)0, 1 ); i = 0; for ( QStringList::Iterator it = args.begin(); it != args.end(); ++it, ++i ) { if ( i == argNum ) s += "<b>" + *it + "</b>"; else s += *it; if ( i < (int)args.count() - 1 ) s += QString::fromLatin1(", "); else s += QString::fromLatin1(" "); } s += QString::fromLatin1(")"); s.prepend( pre ); s.append( post ); label += "<p>" + s + "</p>"; functionLabel->setFunctionText( num, s ); w = qMax( w, functionLabel->fontMetrics().width( s ) + 10 ); } w += 16; if ( label.isEmpty() ) return false; if ( functionLabel->isVisible() ) { functionLabel->resize( w + 50, qMax( functionLabel->fontMetrics().height(), 16 ) ); } else { Q3TextStringChar *chr = cursor->paragraph()->at( cursor->index() ); int h = cursor->paragraph()->lineHeightOfChar( cursor->index() ); int x = cursor->paragraph()->rect().x() + chr->x; int y, dummy; cursor->paragraph()->lineHeightOfChar( cursor->index(), &dummy, &y ); y += cursor->paragraph()->rect().y(); functionLabel->resize( w + 50, qMax( functionLabel->fontMetrics().height(), 16 ) ); functionLabel->move( curEditor->mapToGlobal( curEditor->contentsToViewport( QPoint( x, y + h ) ) ) ); if ( functionLabel->x() + functionLabel->width() > QApplication::desktop()->width() ) functionLabel->move( qMax( 0, QApplication::desktop()->width() - functionLabel->width() ), functionLabel->y() ); functionLabel->show(); curEditor->setFocus(); } QTimer::singleShot( 0, functionLabel, SLOT( relayout() ) ); return true; }
void STNewAccountAuthorizeView::setSize(QSize sz){ if(sz==m_size)return; m_size=sz; relayout(); }
void KTextShapeData::fireResizeEvent() { emit relayout(); }
void CCProgressHUD::setForceSquare(bool var) { m_forceSquare = var; relayout(); }