Bug 70529

Summary: Separator (spacer) and lineseparator (splitter) are seen as one item
Product: [Unmaintained] kdelibs Reporter: Karl Vogel <kvo--kde>
Component: kedittoolbarAssignee: David Faure <faure>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Karl Vogel 2003-12-15 21:07:08 UTC
Version:            (using KDE KDE 3.1.94)
Installed from:    Compiled From Sources
OS:          Linux

There are 2 kinds of separator. One is a plain space separator and the other is a line separator. You can only get the line separator type by manually editing the .ui file as it uses an attribute instead of a full tag.

ie.
- Normal space separator is:  <Separator/>
- Line separator is: <Separator lineseparator="true"/>

kedittoolbar.cpp doesn't know about the attribute 'lineseparator' so you can only get the plain one without a line.


I believe the following old (2001) bug #35829 might have been related to this. (don't know if KDE 2.2.2 worked the same though).
Comment 1 Karl Vogel 2003-12-15 21:09:27 UTC
For example, editing ui_standards.ui like this:

<ToolBar name="mainToolBar"><text>Main Toolbar</text>
  <Action name="file_new"/>
  <Action name="file_open"/>
  <Action name="file_save"/>
  <Action name="file_print"/>
  <Action name="file_print_preview"/>
  <Action name="file_mail"/>
  <Separator lineseparator="true"/>
  <Action name="edit_undo"/>
  <Action name="edit_redo"/>
  <Action name="edit_cut"/>
  <Action name="edit_copy"/>
  <Action name="edit_paste"/>
  <Separator lineseparator="true"/>
  <Action name="edit_find"/>
  <Action name="view_zoom"/>
  <Separator lineseparator="true"/>
  <Action name="go_previous"/>
  <Action name="go_next"/>
  <Action name="go_home"/>
  <Separator lineseparator="true"/>
  <MergeLocal/>
  <Action name="help"/>
</ToolBar>

Will give clean line separators on most toolbars (make those gnome HIG fans happy :)
Comment 2 Karl Vogel 2003-12-15 21:40:55 UTC
Oops.. spamming the bug system.. but..

If the application doesn't use the .ui system but instead handles the toolbar itself, then the only way to get the line based one is by editing the source code!

int KToolBar::insertSeparator(int index, int id)
int KToolBar::insertLineSeparator(int index, int id)

Class reference:
http://developer.kde.org/documentation/library/cvs-api/kdeui/html/classKToolBar.html#a13


Most applications that handle their toolbars themselves, use insertSeparator() which creates a KToolBarSeparator() that doesn't draw a line (line = false):

00170 void KToolBarSeparator::drawContents( QPainter* p )
00171 {
00172     if ( line ) {
00173         QStyle::SFlags flags = QStyle::Style_Default;
00174 
00175         if ( orientation() == Horizontal )
00176             flags = flags | QStyle::Style_Horizontal;
00177 
00178         style().drawPrimitive(QStyle::PE_DockWindowSeparator, p,
00179                               contentsRect(), colorGroup(), flags);
00180     } else {
00181         QFrame::drawContents(p);
00182     }
00183 }


Example:

KATE, KWrite don't use .ui, so even after editing the .ui file, you don't get a line separator.

KEdit does get a line separator after the edit.
Comment 3 Waldo Bastian 2004-01-15 13:14:11 UTC
kate/kwrite defines the toolbar in its own kateui.rc / kwriteui.rc file.

If you make the modification there it will work.

Other than that it seems you would like to have the possibility to add
"splitters" to toolbars in addition to "spacers" via the "Configure Toolbars"
dialog. A valid point IMHO.
Comment 4 David Faure 2004-04-28 22:13:43 UTC
AFAICS this has been implemented now in kedittoolbar.