* make close tab button smaller

* remove spacing in the layout of the tab bar and the central widget


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18770 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stefan Schimanski 2007-06-14 17:57:07 +00:00
parent d00d823352
commit dcaab3cfdd

View File

@ -54,7 +54,7 @@
#include <QDesktopWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QToolButton>
#include <QPushButton>
#include <boost/bind.hpp>
@ -81,7 +81,7 @@ class TabWidget : public QWidget
QHBoxLayout* hlayout;
public:
QTabBar* tabbar;
QToolButton* closeTabButton;
QPushButton* closeTabButton;
void hideTabsIfNecessary()
{
@ -96,24 +96,27 @@ public:
TabWidget(QWidget* w, bool topTabBar)
{
closeTabButton = new QToolButton(this);
closeTabButton = new QPushButton(this);
FileName const file = support::libFileSearch("images", "closetab", "xpm");
if (!file.empty()) {
QPixmap pm(toqstr(file.absFilename()));
closeTabButton->setIcon(QIcon(pm));
closeTabButton->setMaximumSize(pm.size());
closeTabButton->setFlat(true);
} else {
closeTabButton->setText("Close");
}
closeTabButton->setCursor(Qt::ArrowCursor);
closeTabButton->setAutoRaise(true);
closeTabButton->setToolTip(tr("Close tab"));
closeTabButton->setEnabled(true);
tabbar = new QTabBar;
#if QT_VERSION >= 0x040200
tabbar->setUsesScrollButtons(true);
#endif
hlayout = new QHBoxLayout;
QVBoxLayout* vlayout = new QVBoxLayout;
hlayout->addWidget(tabbar);
hlayout->addStretch(1);
hlayout->addWidget(closeTabButton);
if (topTabBar) {
vlayout->addLayout(hlayout);
@ -124,6 +127,7 @@ public:
vlayout->addLayout(hlayout);
}
vlayout->setMargin(0);
vlayout->setSpacing(0);
hlayout->setMargin(0);
setLayout(vlayout);
hideTabsIfNecessary();