本文整理汇总了C++中KAction::setChecked方法的典型用法代码示例。如果您正苦于以下问题:C++ KAction::setChecked方法的具体用法?C++ KAction::setChecked怎么用?C++ KAction::setChecked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KAction
的用法示例。
在下文中一共展示了KAction::setChecked方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createView
KTextEditor::View* HtmlEditor::createView( QWidget* parent )
{
KTextEditor::Document *document = mEditor->createDocument( parent );
bool result = document->setHighlightingMode( "html" );
if ( result ) {
kDebug() << "Syntax highlighting enabled";
}
KTextEditor::View *view = document->createView( parent );
QMenu *menu = view->defaultContextMenu();
KTextEditor::ConfigInterface *interface = qobject_cast< KTextEditor::ConfigInterface* >( view );
if ( interface ) {
KAction *actWordWrap = new KAction( i18n( "Dynamic Word Wrap" ), view );
actWordWrap->setCheckable( true );
connect( actWordWrap, SIGNAL(triggered(bool)), this, SLOT(toggleWordWrap()) );
KAction *actLineNumber = new KAction( i18n("Show line numbers"), view );
actLineNumber->setCheckable( true );
connect( actLineNumber, SIGNAL(triggered(bool)), this, SLOT(toggleLineNumber()) );
QMenu *options = new QMenu( i18n( "Options" ), qobject_cast< QWidget* >( view ) );
options->addAction( actWordWrap );
options->addAction( actLineNumber );
menu->addSeparator();
menu->addMenu( options );
interface->setConfigValue( "dynamic-word-wrap", true );
actWordWrap->setChecked( true );
}
view->setContextMenu( menu );
return view;
}
示例2: populateHeaderActions
void TransfersView::populateHeaderActions()
{
m_headerMenu->clear();
m_headerMenu->addTitle(i18n("Select columns"));
QSignalMapper *columnMapper = new QSignalMapper(this);
connect(columnMapper, SIGNAL(mapped(int)), SLOT(slotHideSection(int)));
//Create for each column an action with the column-header as name
QVector<KAction*> orderedMenuItems(header()->count());
for (int i = 0; i < header()->count(); ++i) {
KAction *action = new KAction(this);
action->setText(model()->headerData(i, Qt::Horizontal).toString());
action->setCheckable(true);
action->setChecked(!header()->isSectionHidden(i));
orderedMenuItems[header()->visualIndex(i)] = action;
connect(action, SIGNAL(toggled(bool)), columnMapper, SLOT(map()));
columnMapper->setMapping(action, i);
}
//append the sorted actions
for (int i = 0; i < orderedMenuItems.count(); ++i) {
m_headerMenu->addAction(orderedMenuItems[i]);
}
}
示例3: setupMenuWindow
void KUI_project::setupMenuWindow()
{
KMenu *windowMenu = new KMenu(i18n("&Window"),this);
KAction *showDesktop = new KAction(i18n("Show &Desktop"),this);
showDesktop->setCheckable(true);
showDesktop->setChecked(true);
//connect(showDesktop, SIGNAL(triggered(bool)), defaultCentral, SLOT(screenVis()));
windowMenu->addAction(showDesktop);
KAction *showCamera = new KAction(i18n("Show &Camera"),this);
showCamera->setCheckable(true);
showCamera->setChecked(true);
windowMenu->addAction(showCamera);
//connect(showCamera, SIGNAL(triggered(bool)), defaultCentral, SLOT(cameraVis()));
menuBar->addMenu(windowMenu);
}
示例4: setupActions
void MainWindow::setupActions()
{
KStandardGameAction::gameNew(m_main, SLOT(newGame()), actionCollection());
KStandardGameAction::restart(m_main, SLOT(restart()), actionCollection());
KStandardGameAction::highscores(m_main, SLOT(highscores()), actionCollection());
KStandardGameAction::quit(this, SLOT(close()), actionCollection());
KAction* action;
action = new KAction(KIcon( QLatin1String( SimpleMenu::iconLocal) ), i18n("&Single Player"), this);
actionCollection()->addAction("game_local", action);
connect(action, SIGNAL(triggered()), m_main, SLOT(localGame()));
action = new KAction(KIcon( QLatin1String( SimpleMenu::iconServer) ), i18n("&Host Game..."), this);
actionCollection()->addAction("game_create_server", action);
connect(action, SIGNAL(triggered()), m_main, SLOT(createServer()));
action = new KAction(KIcon( QLatin1String( SimpleMenu::iconClient) ), i18n("&Connect to Game..."), this);
actionCollection()->addAction("game_create_client", action);
connect(action, SIGNAL(triggered()), m_main, SLOT(createClient()));
action = new KAction(i18n("Change &Nickname..."), this);
actionCollection()->addAction("options_nickname", action);
connect(action, SIGNAL(triggered()), m_main, SLOT(changeNick()));
action = new KToggleAction(i18n("&Play Sounds"), this);
actionCollection()->addAction("options_sounds", action);
connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleSounds(bool)));
// config end of game message
action = new KToggleAction(i18n("Show End-of-Game Message"), this);
action->setChecked(true);
actionCollection()->addAction("options_show_endgame_message", action);
connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleEndOfGameMessage(bool)));
// actions for grid
action = new KToggleAction(i18n("Show &Left Grid"), this);
action->setChecked(true);
actionCollection()->addAction("options_showleftgrid", action);
connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleLeftGrid(bool)));
action = new KToggleAction(i18n("Show &Right Grid"), this);
action->setChecked(true);
actionCollection()->addAction("options_showrightgrid", action);
connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleRightGrid(bool)));
setupGUI();
}
示例5: setupGUILayout
void KBlocksWin::setupGUILayout()
{
QAction *action;
action = KStandardGameAction::gameNew(this, SLOT(singleGame()), actionCollection());
action->setText(i18n("Single Game"));
actionCollection()->addAction( QLatin1String( "newGame" ), action);
action = new KAction(this);
action->setText(i18n("Human vs AI"));
actionCollection()->addAction( QLatin1String( "pve_step" ), action);
connect(action, SIGNAL(triggered(bool)), this, SLOT(pveStepGame()));
m_pauseAction = KStandardGameAction::pause(this, SLOT(pauseGame()), actionCollection());
actionCollection()->addAction( QLatin1String( "pauseGame" ), m_pauseAction);
action = KStandardGameAction::highscores(this, SLOT(showHighscore()), actionCollection());
actionCollection()->addAction( QLatin1String( "showHighscores" ), action);
action = KStandardGameAction::quit(this, SLOT(close()), actionCollection());
actionCollection()->addAction( QLatin1String( "quit" ), action);
KStandardAction::preferences(this, SLOT(configureSettings()), actionCollection());
KAction* soundAction = new KToggleAction(i18n("&Play sounds"), this);
soundAction->setChecked(Settings::sounds());
actionCollection()->addAction( QLatin1String( "sounds" ), soundAction);
connect(soundAction, SIGNAL(triggered(bool)), this, SLOT(setSoundsEnabled(bool)));
// TODO
statusBar()->insertItem( i18n("Points: 0 - Lines: 0 - Level: 0"), 0 );
connect(mpGameScene, SIGNAL(scoreChanged(int,int,int,int)), this, SLOT(onScoreChanged(int,int,int,int)));
connect(mpGameScene, SIGNAL(isHighscore(int,int,int)), this, SLOT(onIsHighscore(int,int,int)));
Kg::difficulty()->addStandardLevelRange(
KgDifficultyLevel::Easy, KgDifficultyLevel::Hard
);
KgDifficultyGUI::init(this);
connect(Kg::difficulty(), SIGNAL(currentLevelChanged(const KgDifficultyLevel*)), SLOT(levelChanged()));
setupGUI();
}
示例6: setupActions
void MainWindow::setupActions()
{
// TODO
#ifndef Q_OS_QNX
// Game
KAction* abort = actionCollection()->addAction("game_abort");
abort->setText(i18n("Abort game"));
connect(abort, SIGNAL(triggered()), m_main, SLOT(abort()));
KStandardGameAction::pause(m_main, SLOT(togglePause()), actionCollection());
KStandardGameAction::highscores(this, SLOT(highscores()), actionCollection());
KStandardGameAction::quit(this, SLOT(close()), actionCollection());
KAction* action;
action = new KToggleAction(i18n("&Play Sounds"), this);
action->setChecked(KollisionConfig::enableSounds());
actionCollection()->addAction("options_sounds", action);
connect(action, SIGNAL(triggered(bool)), m_main, SLOT(enableSounds(bool)));
setupGUI(Create | Save | Keys | StatusBar);
#endif
}
示例7: initActions
void KStars::initActions() {
KIconLoader::global()->addAppDir( "kstars" );
KAction *ka;
// ==== File menu ================
ka = KNS3::standardAction(i18n("Download New Data..."), this, SLOT(slotDownload()), actionCollection(), "get_data")
<< KShortcut( Qt::CTRL+Qt::Key_D );
ka->setWhatsThis(i18n("Downloads new data"));
ka->setToolTip(ka->whatsThis());
ka->setStatusTip(ka->whatsThis());
#ifdef HAVE_CFITSIO_H
actionCollection()->addAction("open_file", this, SLOT(slotOpenFITS()) )
<< i18n("Open FITS...")
<< KIcon("document-open")
<< KShortcut( Qt::CTRL+Qt::Key_O );
#endif
actionCollection()->addAction("export_image", this, SLOT( slotExportImage() ) )
<< i18n("&Save Sky Image...")
<< KIcon("document-export-image")
<< KShortcut( Qt::CTRL+Qt::Key_I );
actionCollection()->addAction("run_script", this, SLOT( slotRunScript() ))
<< i18n("&Run Script...")
<< KIcon("system-run" )
<< KShortcut( Qt::CTRL+Qt::Key_R );
actionCollection()->addAction("printing_wizard", this, SLOT(slotPrintingWizard() ) )
<< i18nc("start Printing Wizard", "Printing &Wizard");
actionCollection()->addAction( KStandardAction::Print, "print", this, SLOT( slotPrint() ) );
actionCollection()->addAction( KStandardAction::Quit, "quit", this, SLOT( close() ) );
// ==== Time Menu ================
actionCollection()->addAction("time_to_now", this, SLOT( slotSetTimeToNow() ))
<< i18n("Set Time to &Now")
<< KShortcut( Qt::CTRL+Qt::Key_E )
<< KIcon("clock");
actionCollection()->addAction("time_dialog", this, SLOT( slotSetTime() ) )
<< i18nc("set Clock to New Time", "&Set Time..." )
<< KShortcut( Qt::CTRL+Qt::Key_S )
<< KIcon("view-history");
ka = actionCollection()->add<KToggleAction>("clock_startstop")
<< i18n("Stop &Clock" )
<< KIcon("media-playback-pause" );
if ( ! StartClockRunning )
ka->toggle();
QObject::connect( ka, SIGNAL( triggered() ), this, SLOT( slotToggleTimer() ) );
QObject::connect(data()->clock(), SIGNAL(clockToggled(bool)), ka, SLOT(setChecked(bool)) );
//UpdateTime() if clock is stopped (so hidden objects get drawn)
QObject::connect(data()->clock(), SIGNAL(clockToggled(bool)), this, SLOT(updateTime()) );
actionCollection()->addAction("time_step_forward", this, SLOT( slotStepForward() ) )
<< i18n("Advance one step forward in time")
<< KIcon("media-skip-forward" )
<< KShortcut( Qt::Key_Greater, Qt::Key_Period );
actionCollection()->addAction("time_step_backward", this, SLOT( slotStepBackward() ) )
<< i18n("Advance one step backward in time")
<< KIcon("media-skip-backward" )
<< KShortcut( Qt::Key_Less, Qt::Key_Comma );
// ==== Pointing Menu ================
actionCollection()->addAction("zenith", this, SLOT( slotPointFocus() ) )
<< i18n("&Zenith")
<< KShortcut("Z");
actionCollection()->addAction("north", this, SLOT( slotPointFocus() ) )
<< i18n("&North")
<< KShortcut("N");
actionCollection()->addAction("east", this, SLOT( slotPointFocus() ) )
<< i18n("&East")
<< KShortcut("E");
actionCollection()->addAction("south", this, SLOT( slotPointFocus() ) )
<< i18n("&South")
<< KShortcut("S");
actionCollection()->addAction("west", this, SLOT( slotPointFocus() ) )
<< i18n("&West")
<< KShortcut("W");
actionCollection()->addAction("find_object", this, SLOT( slotFind() ) )
<< i18n("&Find Object...")
<< KIcon("edit-find")
<< KShortcut( Qt::CTRL+Qt::Key_F );
actionCollection()->addAction("track_object", this, SLOT( slotTrack() ) )
<< i18n("Engage &Tracking")
<< KIcon("object-locked" )
<< KShortcut( Qt::CTRL+Qt::Key_T );
actionCollection()->addAction("manual_focus", this, SLOT( slotManualFocus() ) )
<< i18n("Set Coordinates &Manually..." )
<< KShortcut( Qt::CTRL+Qt::Key_M );
// ==== View Menu ================
actionCollection()->addAction( KStandardAction::ZoomIn, "zoom_in", map(), SLOT( slotZoomIn() ) );
actionCollection()->addAction( KStandardAction::ZoomOut, "zoom_out", map(), SLOT( slotZoomOut() ) );
actionCollection()->addAction("zoom_default", map(), SLOT( slotZoomDefault() ) )
<< i18n("&Default Zoom")
<< KIcon("zoom-fit-best" )
<< KShortcut( Qt::CTRL+Qt::Key_Z );
actionCollection()->addAction("zoom_set", this, SLOT( slotSetZoom() ) )
<< i18n("&Zoom to Angular Size..." )
<< KIcon("zoom-original" )
<< KShortcut( Qt::CTRL+Qt::SHIFT+Qt::Key_Z );
//.........这里部分代码省略.........
示例8: QWidget
//.........这里部分代码省略.........
subtitleBox->setModel(subtitleModel);
KMenu *audioMenu = new KMenu(i18nc("'Playback' menu", "Audio"), this);
KAction *action = new KAction(KIcon(QLatin1String("audio-volume-high")),
i18nc("'Audio' menu", "Increase Volume"), this);
action->setShortcut(KShortcut(Qt::Key_Plus, Qt::Key_VolumeUp));
connect(action, SIGNAL(triggered()), this, SLOT(increaseVolume()));
audioMenu->addAction(collection->addAction(QLatin1String("controls_increase_volume"), action));
action = new KAction(KIcon(QLatin1String("audio-volume-low")),
i18nc("'Audio' menu", "Decrease Volume"), this);
action->setShortcut(KShortcut(Qt::Key_Minus, Qt::Key_VolumeDown));
connect(action, SIGNAL(triggered()), this, SLOT(decreaseVolume()));
audioMenu->addAction(collection->addAction(QLatin1String("controls_decrease_volume"), action));
muteAction = new KAction(i18nc("'Audio' menu", "Mute Volume"), this);
mutedIcon = KIcon(QLatin1String("audio-volume-muted"));
unmutedIcon = KIcon(QLatin1String("audio-volume-medium"));
muteAction->setIcon(unmutedIcon);
muteAction->setShortcut(KShortcut(Qt::Key_M, Qt::Key_VolumeMute));
connect(muteAction, SIGNAL(triggered()), this, SLOT(mutedChanged()));
toolBar->addAction(collection->addAction(QLatin1String("controls_mute_volume"), muteAction));
audioMenu->addAction(muteAction);
menu->addMenu(audioMenu);
KMenu *videoMenu = new KMenu(i18nc("'Playback' menu", "Video"), this);
menu->addMenu(videoMenu);
menu->addSeparator();
deinterlaceAction = new KAction(KIcon(QLatin1String("format-justify-center")),
i18nc("'Video' menu", "Deinterlace"), this);
deinterlaceAction->setCheckable(true);
deinterlaceAction->setChecked(
KGlobal::config()->group("MediaObject").readEntry("Deinterlace", true));
deinterlaceAction->setShortcut(Qt::Key_I);
connect(deinterlaceAction, SIGNAL(toggled(bool)), this, SLOT(deinterlacingChanged(bool)));
backend->setDeinterlacing(deinterlaceAction->isChecked());
videoMenu->addAction(collection->addAction(QLatin1String("controls_deinterlace"), deinterlaceAction));
KMenu *aspectMenu = new KMenu(i18nc("'Video' menu", "Aspect Ratio"), this);
QActionGroup *aspectGroup = new QActionGroup(this);
connect(aspectGroup, SIGNAL(triggered(QAction*)),
this, SLOT(aspectRatioChanged(QAction*)));
action = new KAction(i18nc("'Aspect Ratio' menu", "Automatic"), aspectGroup);
action->setCheckable(true);
action->setChecked(true);
action->setData(AspectRatioAuto);
aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_auto"), action));
action = new KAction(i18nc("'Aspect Ratio' menu", "Fit to Window"), aspectGroup);
action->setCheckable(true);
action->setData(AspectRatioWidget);
aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_widget"), action));
action = new KAction(i18nc("'Aspect Ratio' menu", "4:3"), aspectGroup);
action->setCheckable(true);
action->setData(AspectRatio4_3);
aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_4_3"), action));
action = new KAction(i18nc("'Aspect Ratio' menu", "16:9"), aspectGroup);
action->setCheckable(true);
action->setData(AspectRatio16_9);
aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_16_9"), action));
示例9: QTreeView
CCppcheckWidget::CCppcheckWidget(QWidget* inpParent,
CCppcheckPlugin *inpCppcheckPlugin) :
QTreeView(inpParent),
m_pCppcheckPlugin(inpCppcheckPlugin)
{
setObjectName("cppcheck plugin report");
setWindowTitle("cppcheck");
setWindowIcon(KIcon("cppcheck"));
setRootIsDecorated(true);
setWhatsThis("cppcheck plugin report");
setModel(m_pCppcheckPlugin->getModel());
KAction *pCheckCurrentFile = new KAction(this);
pCheckCurrentFile->setShortcutContext(Qt::WidgetWithChildrenShortcut);
pCheckCurrentFile->setText(i18n("(Re-)launch cppcheck on the current file"));
pCheckCurrentFile->setToolTip(i18n("(Re-)launch cppcheck on the current file"));
pCheckCurrentFile->setIcon(KIcon("view-refresh"));
connect(pCheckCurrentFile, SIGNAL(triggered(bool)), model(), SLOT(parseCurrentFile()));
addAction(pCheckCurrentFile);
KAction *pActionShowErrors = new KAction(this);
addAction(pActionShowErrors);
pActionShowErrors->setCheckable(true);
pActionShowErrors->setChecked(false);
pActionShowErrors->setText(i18n("Show errors"));
pActionShowErrors->setToolTip(i18n("Show errors"));
pActionShowErrors->setIcon(KIcon("user-busy"));
model()->setShowErrors(true);
connect(pActionShowErrors, SIGNAL(triggered(bool)), model(), SLOT(setShowErrors(bool)));
KAction *pActionShowWarnings = new KAction(this);
addAction(pActionShowWarnings);
pActionShowWarnings->setCheckable(true);
pActionShowWarnings->setChecked(false);
pActionShowWarnings->setText(i18n("Show warnings"));
pActionShowWarnings->setToolTip(i18n("Show warnings"));
pActionShowWarnings->setIcon(KIcon("dialog-warning"));
model()->setShowWarnings(true);
connect(pActionShowWarnings, SIGNAL(triggered(bool)), model(), SLOT(setShowWarnings(bool)));
KAction *pActionShowStyle = new KAction(this);
addAction(pActionShowStyle);
pActionShowStyle->setCheckable(true);
pActionShowStyle->setChecked(false);
pActionShowStyle->setText(i18n("Show style warnings"));
pActionShowStyle->setToolTip(i18n("Show style warnings"));
pActionShowStyle->setIcon(KIcon("help-hint"));
model()->setShowStyle(true);
connect(pActionShowStyle, SIGNAL(triggered(bool)), model(), SLOT(setShowStyle(bool)));
KAction *pActionShowPortability = new KAction(this);
addAction(pActionShowPortability);
pActionShowPortability->setCheckable(true);
pActionShowPortability->setChecked(false);
pActionShowPortability->setText(i18n("Show portability warnings"));
pActionShowPortability->setToolTip(i18n("Show portability warnings"));
pActionShowPortability->setIcon(KIcon("office-chart-ring"));
model()->setShowPortability(true);
connect(pActionShowPortability, SIGNAL(triggered(bool)), model(), SLOT(setShowPortability(bool)));
KAction *pActionShowPerformance = new KAction(this);
addAction(pActionShowPerformance);
pActionShowPerformance->setCheckable(true);
pActionShowPerformance->setChecked(false);
pActionShowPerformance->setText(i18n("Show performance warnings"));
pActionShowPerformance->setToolTip(i18n("Show performance warnings"));
pActionShowPerformance->setIcon(KIcon("fork"));
model()->setShowPerformance(true);
connect(pActionShowPerformance, SIGNAL(triggered(bool)), model(), SLOT(setShowPerformance(bool)));
KAction *pActionShowInformation = new KAction(this);
addAction(pActionShowInformation);
pActionShowInformation->setCheckable(true);
pActionShowInformation->setChecked(false);
pActionShowInformation->setText(i18n("Show information messages"));
pActionShowInformation->setToolTip(i18n("Show information messages"));
pActionShowInformation->setIcon(KIcon("help-about"));
model()->setShowInformation(true);
connect(pActionShowInformation, SIGNAL(triggered(bool)), model(), SLOT(setShowInformation(bool)));
}
示例10: fillMenu
void TokenWithLayout::fillMenu( QMenu * menu )
{
DEBUG_BLOCK
KAction *boldAction = new KAction( KIcon( "format-text-bold"), i18n( "Bold" ), menu );
boldAction->setObjectName( ActionBoldName );
boldAction->setCheckable( true );
boldAction->setChecked( m_bold );
KAction *italicAction = new KAction( KIcon( "format-text-italic"), i18n( "Italic" ), menu );
italicAction->setObjectName( ActionItalicName );
italicAction->setCheckable( true );
italicAction->setChecked( m_italic );
KAction *alignLeftAction = new KAction( KIcon( "format-justify-left"), i18n( "Left" ), menu );
KAction *alignCenterAction = new KAction( KIcon( "format-justify-center"), i18n( "Center" ), menu );
KAction *alignRightAction = new KAction( KIcon( "format-justify-right"), i18n( "Right" ), menu );
alignLeftAction->setObjectName( ActionAlignLeftName );
alignLeftAction->setCheckable( true );
alignCenterAction->setObjectName( ActionAlignCenterName );
alignCenterAction->setCheckable( true );
alignRightAction->setObjectName( ActionAlignRightName );
alignRightAction->setCheckable( true );
if ( m_alignment & Qt::AlignLeft )
alignLeftAction->setChecked( true );
else if ( m_alignment & Qt::AlignHCenter )
alignCenterAction->setChecked( true );
else if ( m_alignment & Qt::AlignRight )
alignRightAction->setChecked( true );
QActionGroup *alignmentGroup = new QActionGroup( menu );
alignmentGroup->addAction( alignLeftAction );
alignmentGroup->addAction( alignCenterAction );
alignmentGroup->addAction( alignRightAction );
menu->addAction( boldAction );
menu->addAction( italicAction );
menu->addSeparator()->setText( i18n( "Alignment" ) );
menu->addAction( alignLeftAction );
menu->addAction( alignCenterAction );
menu->addAction( alignRightAction );
menu->addSeparator()->setText( i18n( "Width" ) );
menu->adjustSize();
int orgHeight = menu->height();
KHBox * sliderBox = new KHBox( menu );
sliderBox->setFixedWidth( menu->width() - 4 );
sliderBox->move( sliderBox->pos().x() + 2, orgHeight );
QSlider * slider = new QSlider( Qt::Horizontal, sliderBox );
slider->setMaximum( 100 );
slider->setMinimum( 0 );
// this should really not be done here as it makes upward assumptions
// it was however done in setWidth with similar upward assumptions as well
// solution: the popup stuff -iff- should be done in the dialog or the editWidget
if ( parentWidget() )
{
if ( TokenDropTarget *editWidget = qobject_cast<TokenDropTarget*>( parentWidget() ) )
{
qreal spareWidth = 100.0;
int row = editWidget->row( this );
if ( row > -1 )
{
QList<Token*> tokens = editWidget->drags( row );
foreach (Token *t, tokens)
{
if (t == this)
continue;
if ( TokenWithLayout *twl = qobject_cast<TokenWithLayout*>( t ) )
spareWidth -= twl->width() * 100.0;
}
}
int max = qMax( spareWidth, 0.0 );
debug() << "slider max value: " << max;
if ( max >= m_width * 100.0 )
slider->setMaximum( qMax( spareWidth, 0.0 ) );
else
slider->setMaximum( m_width * 100.0 );
}