bool KFileView::updateNumbers(const KFileItem *i) { if (!( viewMode() & Files ) && i->isFile()) return false; if (!( viewMode() & Directories ) && i->isDir()) return false; if (i->isDir()) dirsNumber++; else filesNumber++; return true; }
QModelIndex FolderViewListView::indexAt(const QPoint& point) const { QModelIndex index = QListView::indexAt(point); // NOTE: QListView has a severe design flaw here. It does hit-testing based on the // total bound rect of the item. The width of an item is determined by max(icon_width, text_width). // So if the text label is much wider than the icon, when you click outside the icon but // the point is still within the outer bound rect, the item is still selected. // This results in very poor usability. Let's do precise hit-testing here. // An item is hit only when the point is in the icon or text label. // If the point is in the bound rectangle but outside the icon or text, it should not be selected. if(viewMode() == QListView::IconMode && index.isValid()) { // FIXME: this hack only improves the usability partially. We still need more precise sizeHint handling. // FolderItemDelegate* delegate = static_cast<FolderItemDelegate*>(itemDelegateForColumn(FolderModel::ColumnFileName)); // Q_ASSERT(delegate != NULL); // We use the grid size - (2, 2) as the size of the bounding rectangle of the whole item. // The width of the text label hence is gridSize.width - 2, and the width and height of the icon is from iconSize(). QRect visRect = visualRect(index); // visibal area on the screen QSize itemSize = gridSize(); itemSize.setWidth(itemSize.width() - 2); itemSize.setHeight(itemSize.height() - 2); QSize _iconSize = iconSize(); int textHeight = itemSize.height() - _iconSize.height(); if(point.y() < visRect.bottom() - textHeight) { // the point is in the icon area, not over the text label int iconXMargin = (itemSize.width() - _iconSize.width()) / 2; if(point.x() < (visRect.left() + iconXMargin) || point.x() > (visRect.right() - iconXMargin)) return QModelIndex(); } // qDebug() << "visualRect: " << visRect << "point:" << point; } return index; }
void ImportView::toggleShowBar(bool b) { d->stackedView->thumbBarDock()->showThumbBar(b); // See bug #319876 : force to reload current view mode to set thumbbar visibility properly. d->stackedView->setViewMode(viewMode()); }
void ViewSettingsTab::applySettings() { const QFont font = m_fontRequester->currentFont(); const bool useSystemFont = (m_fontRequester->mode() == DolphinFontRequester::SystemFont); switch (m_mode) { case IconsMode: IconsModeSettings::setTextWidthIndex(m_widthBox->currentIndex()); IconsModeSettings::setMaximumTextLines(m_maxLinesBox->currentIndex()); break; case CompactMode: CompactModeSettings::setMaximumTextWidthIndex(m_widthBox->currentIndex()); break; case DetailsMode: DetailsModeSettings::setExpandableFolders(m_expandableFolders->isChecked()); break; default: break; } ViewModeSettings settings(viewMode()); const int iconSize = ZoomLevelInfo::iconSizeForZoomLevel(m_defaultSizeSlider->value()); const int previewSize = ZoomLevelInfo::iconSizeForZoomLevel(m_previewSizeSlider->value()); settings.setIconSize(iconSize); settings.setPreviewSize(previewSize); settings.setUseSystemFont(useSystemFont); settings.setFontFamily(font.family()); settings.setFontSize(font.pointSizeF()); settings.setItalicFont(font.italic()); settings.setFontWeight(font.weight()); settings.writeConfig(); }
void QPreviewFileDialog::reject() { int exit; //if there's no parent, we ask the user whether he really //wants to cancel saving; otherwise we assume, that the //parent will warn the user if(mWarnOnCancel) { exit=QMessageBox::warning(this, tr("Cancel..."), tr("The image has not been saved.\n" "Do you really want to cancel?"), tr("&Yes"),tr("&No")); if(exit == 1) { return; } } if(mpImage && mMustDeleteImage) delete mpImage; int view_mode = int(viewMode()); //What the hell is this? Not enough, that viewMode() only works, as //long as the dialog is visible, it also returns the wrong values //(0 when it should return 1 and vice versa) //At least, this stupid behaviour is consistent in all versions //of Qt2.2.x. If this is fixed in Qt3, the following lines must //be removed. if(view_mode == 0) view_mode = 1; else if(view_mode == 1) view_mode = 0; xmlConfig->setIntValue("SINGLEFILE_VIEW_MODE",view_mode); QDialog::reject(); }
void FolderView::setIconSize(ViewMode mode, QSize size) { Q_ASSERT(mode >= FirstViewMode && mode <= LastViewMode); iconSize_[mode - FirstViewMode] = size; if(viewMode() == mode) { view->setIconSize(size); if(model_) model_->setThumbnailSize(size.width()); } }
QStyleOptionViewItem SearchListView::viewOptions() const { QStyleOptionViewItem option = QListView::viewOptions(); if (viewMode() == QListView::ListMode) option.decorationPosition = QStyleOptionViewItem::Right; return option; }
void FolderView::onSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected) { QItemSelectionModel* selModel = static_cast<QItemSelectionModel*>(sender()); int nSel = 0; if(viewMode() == DetailedListMode) nSel = selModel->selectedRows().count(); else nSel = selModel->selectedIndexes().count(); // qDebug()<<"selected:" << nSel; Q_EMIT selChanged(nSel); // FIXME: this is inefficient }
void KexiView::setAvailable(const QString& action_name, bool set) { if (part()) { KActionCollection *ac; QAction* a; if ((ac = part()->actionCollectionForMode(viewMode())) && (a = ac->action(action_name))) { a->setEnabled(set); } } KexiActionProxy::setAvailable(action_name, set); }
int QMdiArea::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QAbstractScrollArea::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 14) qt_static_metacall(this, _c, _id, _a); _id -= 14; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QBrush*>(_v) = background(); break; case 1: *reinterpret_cast< WindowOrder*>(_v) = activationOrder(); break; case 2: *reinterpret_cast< ViewMode*>(_v) = viewMode(); break; case 3: *reinterpret_cast< bool*>(_v) = documentMode(); break; case 4: *reinterpret_cast< bool*>(_v) = tabsClosable(); break; case 5: *reinterpret_cast< bool*>(_v) = tabsMovable(); break; case 6: *reinterpret_cast< QTabWidget::TabShape*>(_v) = tabShape(); break; case 7: *reinterpret_cast< QTabWidget::TabPosition*>(_v) = tabPosition(); break; } _id -= 8; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setBackground(*reinterpret_cast< QBrush*>(_v)); break; case 1: setActivationOrder(*reinterpret_cast< WindowOrder*>(_v)); break; case 2: setViewMode(*reinterpret_cast< ViewMode*>(_v)); break; case 3: setDocumentMode(*reinterpret_cast< bool*>(_v)); break; case 4: setTabsClosable(*reinterpret_cast< bool*>(_v)); break; case 5: setTabsMovable(*reinterpret_cast< bool*>(_v)); break; case 6: setTabShape(*reinterpret_cast< QTabWidget::TabShape*>(_v)); break; case 7: setTabPosition(*reinterpret_cast< QTabWidget::TabPosition*>(_v)); break; } _id -= 8; } else if (_c == QMetaObject::ResetProperty) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 8; } #endif // QT_NO_PROPERTIES return _id; }
void WorldTime::cancelChanges() { viewMode(); if(changed) for (int i = 0; i < maxVisibleZones; i++) { if(listCities.at(i)->isChecked()) { listCities.at(i)->setChecked(false); } } changed = false; }
QAction* KexiView::sharedAction(const QString& action_name) { if (part()) { KActionCollection *ac; if ((ac = part()->actionCollectionForMode(viewMode()))) { QAction* a = ac->action(action_name); if (a) return a; } } return KexiActionProxy::sharedAction(action_name); }
KPrView::KPrView(KPrPart *part, KPrDocument *document, QWidget *parent) : KoPAView(part, document, KoPAView::ModeBox, parent) , m_part(part) , m_presentationMode( new KPrViewModePresentation( this, kopaCanvas() )) , m_normalMode( viewMode() ) , m_notesMode( new KPrViewModeNotes( this, kopaCanvas() )) , m_slidesSorterMode(new KPrViewModeSlidesSorter(this, kopaCanvas())) #ifndef CALLIGRA_DISABLE_DBUS , m_dbus(new KPrViewAdaptor( this ) ) #else , m_dbus(0) #endif { m_normalMode->setName(i18n("Normal")); initGUI(); initActions(); // Change strings because in KPresenter it's called slides and not pages actionCollection()->action("view_masterpages")->setText(i18n("Show Master Slides")); actionCollection()->action("import_document")->setText(i18n("Import Slideshow...")); actionCollection()->action("page_insertpage")->setText(i18n( "Insert Slide")); actionCollection()->action("page_insertpage")->setToolTip(i18n("Insert a new slide after the current one")); actionCollection()->action("page_insertpage")->setWhatsThis(i18n("Insert a new slide after the current one")); actionCollection()->action("page_copypage")->setText(i18n("Copy Slide")); actionCollection()->action("page_copypage")->setToolTip(i18n("Copy the current slide")); actionCollection()->action("page_copypage")->setWhatsThis(i18n("Copy the current slide")); actionCollection()->action("page_deletepage")->setText(i18n("Delete Slide")); actionCollection()->action("page_deletepage")->setToolTip(i18n("Delete the current slide")); actionCollection()->action("page_deletepage")->setWhatsThis(i18n("Delete the current slide")); actionCollection()->action("format_masterpage")->setText(i18n("Master Slide...")); actionCollection()->action("page_previous")->setText(i18n("Previous Slide")); actionCollection()->action("page_previous")->setToolTip(i18n("Go to previous slide")); actionCollection()->action("page_previous")->setWhatsThis(i18n("Go to previous slide")); actionCollection()->action("page_next")->setText(i18n("Next Slide")); actionCollection()->action("page_next")->setToolTip(i18n("Go to next slide")); actionCollection()->action("page_next")->setWhatsThis(i18n("Go to next slide")); actionCollection()->action("page_first")->setText(i18n("First Slide")); actionCollection()->action("page_first")->setToolTip(i18n("Go to first slide")); actionCollection()->action("page_first")->setWhatsThis(i18n("Go to first slide")); actionCollection()->action("page_last")->setText(i18n("Last Slide")); actionCollection()->action("page_last")->setToolTip(i18n("Go to last slide")); actionCollection()->action("page_last")->setWhatsThis(i18n("Go to last slide")); actionCollection()->action("configure")->setText(i18n("Configure Stage...")); masterShapeManager()->setPaintingStrategy( new KPrShapeManagerDisplayMasterStrategy( masterShapeManager(), new KPrPageSelectStrategyActive( kopaCanvas() ) ) ); connect(zoomController(), SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)), this, SLOT(zoomChanged(KoZoomMode::Mode,qreal))); setAcceptDrops(true); }
void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group) { /* IMAGE */ QPixmap chanImage; if (group.mImage.mData != NULL) { chanImage.loadFromData(group.mImage.mData, group.mImage.mSize, "PNG"); } else { chanImage = QPixmap(CHAN_DEFAULT_IMAGE); } ui->logoLabel->setPixmap(chanImage); ui->subscribersLabel->setText(QString::number(group.mMeta.mPop)) ; if (group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH) { mStateHelper->setWidgetEnabled(ui->postButton, true); } else { mStateHelper->setWidgetEnabled(ui->postButton, false); } ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags)); bool autoDownload ; rsGxsChannels->getChannelAutoDownload(group.mMeta.mGroupId,autoDownload); setAutoDownload(autoDownload); if (IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags)) { ui->feedToolButton->setEnabled(true); ui->fileToolButton->setEnabled(true); ui->infoWidget->hide(); setViewMode(viewMode()); ui->infoPosts->clear(); ui->infoDescription->clear(); } else { ui->infoPosts->setText(QString::number(group.mMeta.mVisibleMsgCount)); ui->infoDescription->setText(QString::fromUtf8(group.mDescription.c_str())); ui->infoWidget->show(); ui->feedWidget->hide(); ui->fileWidget->hide(); ui->feedToolButton->setEnabled(false); ui->fileToolButton->setEnabled(false); } }
void ActionView::setViewMode(int lm) { if (viewMode() == lm) return; switch (lm) { case IconView: setCurrentWidget(m_actionListView); break; case DetailedView: setCurrentWidget(m_actionTreeView); break; default: break; } }
void GameScene::clickedDashboardButton() { #if defined Q_WS_MAEMO_5 QDBusConnection connection = QDBusConnection::sessionBus(); QDBusMessage message = QDBusMessage::createSignal("/","com.nokia.hildon_desktop","exit_app_view"); connection.send(message); #elif (defined Q_OS_LINUX || defined Q_OS_MAC || defined Q_OS_WIN32) && !defined OS_IS_HARMATTAN && !defined OS_IS_ANDROID if(viewMode() == ViewNormal) { setViewMode(ViewFullScreen); } else { setViewMode(ViewNormal); } #else qDebug() << "Dashboard button should not have been shown..."; #endif }
QWidget* ImprovedWorkspace::addWindow(QWidget* child,QAction* action) { QMdiSubWindow* sub = addSubWindow(child); if(viewMode()==QMdiArea::TabbedView) { action->setChecked(true); sub->setVisible(true); child->setVisible(true); } insertActionAndSubWindow(action,sub); connect(action,SIGNAL(triggered()),this,SLOT(ensurePresent())); sub->setAttribute(Qt::WA_DeleteOnClose, false); child->setAttribute(Qt::WA_DeleteOnClose, false); sub->setObjectName(child->objectName()); sub->installEventFilter(this); return sub; }
void ImprovedWorkspace::addContainerMedia(MediaContainer* mediac) { if(NULL!=mediac) { addSubWindow(mediac); insertActionAndSubWindow(mediac->getAction(),mediac); if(viewMode()==QMdiArea::TabbedView) { mediac->setVisible(true); } mediac->setAttribute(Qt::WA_DeleteOnClose, false); if(NULL!=mediac->widget()) { mediac->widget()->setAttribute(Qt::WA_DeleteOnClose, false); } mediac->installEventFilter(this); } }
void QPreviewFileDialog::accept() { ImageIOSupporter iisup; QString qs; mFilePath = selectedFile(); format(); if(mFilePath == xmlConfig->absConfDirPath()+".scantemp.pnm") { QMessageBox::information(this,tr("Information"), tr("You can not save the image under the name\n" "of the temporary image file, because it\n" "will be overwritten with the next scan."),tr("OK")); return; } if(mImageFormat == "") { QMessageBox::information(this,tr("Information"), tr("You did not specify a valid image format.\n" "Either append a valid extension to the filename,\n" "or select a file filter."),tr("OK")); return; } if(!iisup.saveImageInteractive(mFilePath,*mpImage,mImageFormat,this)) { return; } xmlConfig->setStringValue("SINGLEFILE_SAVE_PATH",dir()->absPath()); int view_mode = int(viewMode()); //What the hell is this? Not enough, that viewMode() only works, as //long as the dialog is visible, it also returns the wrong values //(0 when it should return 1 and vice versa) //At least, this stupid behaviour is consistent in all versions //of Qt2.2.x. If this is fixed in Qt3, the following lines must //be removed. if(view_mode == 0) view_mode = 1; else if(view_mode == 1) view_mode = 0; xmlConfig->setIntValue("SINGLEFILE_VIEW_MODE",view_mode); xmlConfig->setStringValue("VIEWER_IMAGE_TYPE", iisup.getDataFromOutFilter(selectedFilter())); if(mpImage && mMustDeleteImage) delete mpImage; QDialog::accept(); }
void LauncherView::calculateGridSize(bool force) { if(!force && !isVisible()) { mNeedGridSize = true; return; } mNeedGridSize = false; QSize grSize; Q_ASSERT(model); Q_ASSERT(icons); int dw = width(); int viewerWidth = dw - style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, icons->verticalScrollBar()) - 1; int iconHeight = 0; if ( viewMode() == QListView::IconMode ) { int width = viewerWidth/nColumns; iconHeight = width - fontMetrics().height() * 2; grSize = QSize(width, width); QSize icoSize = QSize(iconHeight, iconHeight); icons->setIconSize(icoSize); } else { icons->setSpacing(1); int viewHeight = geometry().height(); qreal scalingFactor = 1.65; if (Qtopia::mousePreferred()) scalingFactor = 1.8; int nbRow = int(qAbs(viewHeight / (fontMetrics().height() * scalingFactor))); iconHeight = qRound(viewHeight / nbRow); grSize = QSize((viewerWidth-(nColumns+1)*icons->spacing())/nColumns, iconHeight); QSize icoSize = QSize(iconHeight - 4, iconHeight - 4); icons->setIconSize(icoSize); #ifdef ENABLE_SMOOTHLIST smoothicons->setIconSize(icoSize); #endif } icons->setGridSize(grSize); }
void WorldTime::selected() { if(!changed) { changed = true; } else { QTimeZone zone = frmMap->zone(); int selButton = findCurrentButton(); if(selButton != -1 ) { strCityTz[selButton] = zone.id(); // qWarning() << "selected" << strCityTz[selButton] << zone.id(); listCities.at(selButton)->setText( zone.city()); listTimes.at(selButton)->setZone( zone.id()); saveChanges(); changed = false; } viewMode(); } }
void WorldTime::writeTimezoneChanges() { changed = true; QSettings cfg("Trolltech", "WorldTime"); cfg.beginGroup("TimeZones"); int i; for ( i = 0; i < maxVisibleZones; i++) { if ( !strCityTz[i].isNull() ) { cfg.setValue("Zone"+QString::number(i), strCityTz[i]); // qWarning()<<QString::number(i) << strCityTz[i]; } } cfg.sync(); emit timeZoneListChange(); viewMode(); changed = false; }
KPrView::KPrView( KPrDocument *document, QWidget *parent ) : KoPAView( document, parent ) , m_presentationMode( new KPrViewModePresentation( this, kopaCanvas() )) , m_normalMode( viewMode() ) , m_notesMode( new KPrViewModeNotes( this, kopaCanvas() )) // , m_slidesSorterMode( new KPrViewModeSlidesSorter( this, kopaCanvas() )) , m_dbus( new KPrViewAdaptor( this ) ) { initGUI(); initActions(); // Change strings because in KPresenter it's called slides and not pages actionCollection()->action("view_masterpages")->setText(i18n("Show Master Slides")); actionCollection()->action("import_document")->setText(i18n("Import Slideshow...")); actionCollection()->action("page_insertpage")->setText(i18n( "Insert Slide")); actionCollection()->action("page_insertpage")->setToolTip(i18n("Insert a new slide after the current one")); actionCollection()->action("page_insertpage")->setWhatsThis(i18n("Insert a new slide after the current one")); actionCollection()->action("page_copypage")->setText(i18n("Copy Slide")); actionCollection()->action("page_copypage")->setToolTip(i18n("Copy the current slide")); actionCollection()->action("page_copypage")->setWhatsThis(i18n("Copy the current slide")); actionCollection()->action("page_deletepage")->setText(i18n("Delete Slide")); actionCollection()->action("page_deletepage")->setToolTip(i18n("Delete the current slide")); actionCollection()->action("page_deletepage")->setWhatsThis(i18n("Delete the current slide")); actionCollection()->action("format_masterpage")->setText(i18n("Master Slide...")); actionCollection()->action("page_previous")->setText(i18n("Previous Slide")); actionCollection()->action("page_next")->setText(i18n("Next Slide")); actionCollection()->action("page_first")->setText(i18n("First Slide")); actionCollection()->action("page_last")->setText(i18n("Last Slide")); actionCollection()->action("configure")->setText(i18n("Configure KPresenter...")); masterShapeManager()->setPaintingStrategy( new KPrShapeManagerDisplayMasterStrategy( masterShapeManager(), new KPrPageSelectStrategyActive( kopaCanvas() ) ) ); KoPACanvas * canvas = dynamic_cast<KoPACanvas*>(kopaCanvas()); if (canvas) { m_slidesSorterMode = new KPrViewModeSlidesSorter(this, canvas); } }
void GxsChannelPostsWidget::processSettings(bool load) { Settings->beginGroup(QString("ChannelPostsWidget")); if (load) { // load settings /* Filter */ ui->filterLineEdit->setCurrentFilter(Settings->value("filter", FILTER_TITLE).toInt()); /* View mode */ setViewMode(Settings->value("viewMode", VIEW_MODE_FEEDS).toInt()); } else { // save settings /* Filter */ Settings->setValue("filter", ui->filterLineEdit->currentFilter()); /* View mode */ Settings->setValue("viewMode", viewMode()); } Settings->endGroup(); }
void ViewSettingsTab::loadSettings() { switch (m_mode) { case IconsMode: m_widthBox->setCurrentIndex(IconsModeSettings::textWidthIndex()); m_maxLinesBox->setCurrentIndex(IconsModeSettings::maximumTextLines()); break; case CompactMode: m_widthBox->setCurrentIndex(CompactModeSettings::maximumTextWidthIndex()); break; case DetailsMode: m_expandableFolders->setChecked(DetailsModeSettings::expandableFolders()); break; default: break; } ViewModeSettings settings(viewMode()); settings.readConfig(); const QSize iconSize(settings.iconSize(), settings.iconSize()); m_defaultSizeSlider->setValue(ZoomLevelInfo::zoomLevelForIconSize(iconSize)); const QSize previewSize(settings.previewSize(), settings.previewSize()); m_previewSizeSlider->setValue(ZoomLevelInfo::zoomLevelForIconSize(previewSize)); m_fontRequester->setMode(settings.useSystemFont() ? DolphinFontRequester::SystemFont : DolphinFontRequester::CustomFont); QFont font(settings.fontFamily(), qRound(settings.fontSize())); font.setItalic(settings.italicFont()); font.setWeight(settings.fontWeight()); font.setPointSizeF(settings.fontSize()); m_fontRequester->setCustomFont(font); }
KexiFormView::KexiFormView(QWidget *parent, bool dbAware) : KexiDataAwareView(parent) , d(new Private) { Q_UNUSED(dbAware); d->delayedFormContentsResizeOnShow = 0; //! @todo remove? setSortedProperties(true); d->scrollView = new KexiFormScrollView( // will be added to layout this, viewMode() == Kexi::DataViewMode); // in KexiDataAwareView::init() initForm(); if (viewMode() == Kexi::DesignViewMode) { connect(form(), SIGNAL(propertySetSwitched()), this, SLOT(slotPropertySetSwitched())); connect(form(), SIGNAL(modified(bool)), this, SLOT(setDirty(bool))); connect(d->scrollView, SIGNAL(resized()), this, SLOT(setFormModified())); connect(d->dbform, SIGNAL(handleDragMoveEvent(QDragMoveEvent*)), this, SLOT(slotHandleDragMoveEvent(QDragMoveEvent*))); connect(d->dbform, SIGNAL(handleDropEvent(QDropEvent*)), this, SLOT(slotHandleDropEvent(QDropEvent*))); // action stuff plugSharedAction("formpart_taborder", form(), SLOT(editTabOrder())); plugSharedAction("formpart_adjust_size", form(), SLOT(adjustWidgetSize())); //! @todo add formpart_pixmap_collection action //! @todo add formpart_connections action plugSharedAction("edit_copy", form(), SLOT(copyWidget())); plugSharedAction("edit_cut", form(), SLOT(cutWidget())); plugSharedAction("edit_paste", form(), SLOT(pasteWidget())); plugSharedAction("edit_delete", form(), SLOT(deleteWidget())); plugSharedAction("edit_select_all", form(), SLOT(selectAll())); plugSharedAction("formpart_clear_contents", form(), SLOT(clearWidgetContent())); plugSharedAction("edit_undo", form(), SLOT(undo())); plugSharedAction("edit_redo", form(), SLOT(redo())); //! @todo add formpart_layout_menu action plugSharedAction("formpart_layout_hbox", form(), SLOT(layoutHBox())); plugSharedAction("formpart_layout_vbox", form(), SLOT(layoutVBox())); plugSharedAction("formpart_layout_grid", form(), SLOT(layoutGrid())); #ifdef KEXI_SHOW_SPLITTER_WIDGET plugSharedAction("formpart_layout_hsplitter", form(), SLOT(layoutHSplitter())); plugSharedAction("formpart_layout_vsplitter", form(), SLOT(layoutVSplitter())); #endif plugSharedAction("formpart_break_layout", form(), SLOT(breakLayout())); plugSharedAction("formpart_format_raise", form(), SLOT(bringWidgetToFront())); plugSharedAction("formpart_format_lower", form(), SLOT(sendWidgetToBack())); plugSharedAction("other_widgets_menu", form(), 0); setAvailable("other_widgets_menu", true); plugSharedAction("formpart_align_menu", form(), 0); plugSharedAction("formpart_align_to_left", form(), SLOT(alignWidgetsToLeft())); plugSharedAction("formpart_align_to_right", form(), SLOT(alignWidgetsToRight())); plugSharedAction("formpart_align_to_top", form(), SLOT(alignWidgetsToTop())); plugSharedAction("formpart_align_to_bottom", form(), SLOT(alignWidgetsToBottom())); plugSharedAction("formpart_align_to_grid", form(), SLOT(alignWidgetsToGrid())); plugSharedAction("formpart_adjust_size_menu", form(), 0); plugSharedAction("formpart_adjust_to_fit", form(), SLOT(adjustWidgetSize())); plugSharedAction("formpart_adjust_size_grid", form(), SLOT(adjustSizeToGrid())); plugSharedAction("formpart_adjust_height_small", form(), SLOT(adjustHeightToSmall())); plugSharedAction("formpart_adjust_height_big", form(), SLOT(adjustHeightToBig())); plugSharedAction("formpart_adjust_width_small", form(), SLOT(adjustWidthToSmall())); plugSharedAction("formpart_adjust_width_big", form(), SLOT(adjustWidthToBig())); plugSharedAction("format_font", form(), SLOT(changeFont())); // - setup local actions QList<QAction*> viewActions; QAction* a; a = form()->action("edit_undo"); a->setProperty("iconOnly", true); viewActions << a; a = form()->action("edit_redo"); a->setProperty("iconOnly", true); viewActions << a; setViewActions(viewActions); }
void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group) { /* IMAGE */ QPixmap chanImage; if (group.mImage.mData != NULL) { chanImage.loadFromData(group.mImage.mData, group.mImage.mSize, "PNG"); } else { chanImage = QPixmap(CHAN_DEFAULT_IMAGE); } ui->logoLabel->setPixmap(chanImage); ui->subscribersLabel->setText(QString::number(group.mMeta.mPop)) ; if (group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH) { mStateHelper->setWidgetEnabled(ui->postButton, true); } else { mStateHelper->setWidgetEnabled(ui->postButton, false); } ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags)); bool autoDownload ; rsGxsChannels->getChannelAutoDownload(group.mMeta.mGroupId,autoDownload); setAutoDownload(autoDownload); if (IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags)) { ui->feedToolButton->setEnabled(true); ui->fileToolButton->setEnabled(true); ui->infoWidget->hide(); setViewMode(viewMode()); ui->infoPosts->clear(); ui->infoDescription->clear(); } else { ui->infoPosts->setText(QString::number(group.mMeta.mVisibleMsgCount)); ui->infoDescription->setText(QString::fromUtf8(group.mDescription.c_str())); ui->infoAdministrator->setId(group.mMeta.mAuthorId) ; QString distrib_string ( "[unknown]" ); switch(group.mMeta.mCircleType) { case GXS_CIRCLE_TYPE_PUBLIC: distrib_string = tr("Public") ; break ; case GXS_CIRCLE_TYPE_EXTERNAL: { RsGxsCircleDetails det ; // !! What we need here is some sort of CircleLabel, which loads the circle and updates the label when done. if(rsGxsCircles->getCircleDetails(group.mMeta.mCircleId,det)) distrib_string = tr("Restricted to members of circle \"")+QString::fromUtf8(det.mCircleName.c_str()) +"\""; else distrib_string = tr("Restricted to members of circle ")+QString::fromStdString(group.mMeta.mCircleId.toStdString()) ; } break ; case GXS_CIRCLE_TYPE_YOUR_EYES_ONLY: distrib_string = tr("Your eyes only"); break ; case GXS_CIRCLE_TYPE_LOCAL: distrib_string = tr("You and your friend nodes"); break ; default: std::cerr << "(EE) badly initialised group distribution ID = " << group.mMeta.mCircleType << std::endl; } ui->infoDistribution->setText(distrib_string); ui->infoWidget->show(); ui->feedWidget->hide(); ui->fileWidget->hide(); ui->feedToolButton->setEnabled(false); ui->fileToolButton->setEnabled(false); } }
void ListView_Impl::paintDropTarget(QPainter *painter, const QModelIndex& index, int where) { QStyleOptionViewItem option = viewOptions(); QRect rect = this->visualRect(index); QWidget *viewport = this->viewport(); QColor highlight = palette().color(QPalette::HighlightedText); QColor color = option.state & QStyle::State_Selected ? highlight : palette().color(QPalette::Highlight); QPen pen(color); painter->save(); if (!index.isValid()) where = SL_EVENT_DRAG_ON_VIEWPORT; switch (where) { case SL_EVENT_DRAG_BELOW_ITEM: case SL_EVENT_DRAG_ABOVE_ITEM: { if (viewMode() == IconMode) { QSize size = gridSize(); if (size.isEmpty()) size = rect.size(); int x, y, height = size.height(); int cellWidth = size.width() + spacing(); int cellHeight = height + spacing(); x = rect.left() + horizontalOffset(); if (where == SL_EVENT_DRAG_BELOW_ITEM) x += cellWidth; x = ((x / cellWidth) * cellWidth) - horizontalOffset(); y = (((rect.top() + verticalOffset()) / cellHeight) * cellHeight) - verticalOffset(); height = qMax(5, height - 5); painter->setRenderHint(QPainter::Antialiasing); pen.setWidth(3); pen.setColor(highlight); painter->setPen(pen); painter->drawEllipse(QPointF(x, y + height), 3, 3); painter->drawLine(x, y + 5, x, y + height - 3); pen.setWidth(2); pen.setColor(color); painter->setPen(pen); painter->drawEllipse(QPointF(x, y + height), 3, 3); painter->drawLine(x, y + 5, x, y + height - 3); } else { int x, y, width; if (where == SL_EVENT_DRAG_BELOW_ITEM) y = rect.bottom() + 1; else y = rect.top(); x = rect.left(); width = viewport->width() - rect.left() - 10; painter->setRenderHint(QPainter::Antialiasing); pen.setWidth(3); pen.setColor(highlight); painter->setPen(pen); painter->drawEllipse(QPointF(x + width, y), 3, 3); painter->drawLine(x, y, x + width - 3, y); pen.setWidth(2); pen.setColor(color); painter->setPen(pen); painter->drawEllipse(QPointF(x + width, y), 3, 3); painter->drawLine(x, y, x + width - 3, y); } } break; case SL_EVENT_DRAG_ON_ITEM: { option.rect = rect; rect.adjust(1, 1, -1, -1); painter->setRenderHint(QPainter::Antialiasing); int radius = qMin(8, rect.height() / 2); pen.setWidth(3); pen.setColor(highlight); painter->setPen(pen); painter->drawRoundedRect(rect, radius, radius); pen.setWidth(2); if (viewMode() == IconMode) { color = palette().color(QPalette::Inactive, QPalette::Highlight); pen.setColor(color); painter->setPen(pen); painter->setBrush(QBrush(color)); painter->drawRoundedRect(rect, radius, radius); QItemSelectionModel *selection = selectionModel(); if ((selection) && (selection->isSelected(index))) option.state |= QStyle::State_Selected; if (!(model()->flags(index) & Qt::ItemIsEnabled)) option.state &= ~QStyle::State_Enabled; if (option.state & QStyle::State_Enabled) option.palette.setCurrentColorGroup(QPalette::Normal); else option.palette.setCurrentColorGroup(QPalette::Disabled); itemDelegate(index)->paint(painter, option, index); } else { pen.setColor(color); painter->setPen(pen); painter->drawRoundedRect(rect, radius, radius); } } break; case SL_EVENT_DRAG_ON_VIEWPORT: { rect = viewport->rect(); rect.adjust(0, 0, -1, -1); painter->setRenderHint(QPainter::Antialiasing, false); pen.setWidth(5); pen.setColor(highlight); painter->setPen(pen); painter->drawRect(rect); pen.setWidth(3); pen.setColor(color); painter->setPen(pen); painter->drawRect(rect); } break; } painter->restore(); }
KoViewConverter * KPrView::viewConverter( KoPACanvasBase * canvas ) { Q_ASSERT(viewMode()); return viewMode()->viewConverter( canvas ); }
bool KPrView::isPresentationRunning() const { return ( viewMode() == m_presentationMode ); }