fixed scene toolbar layout problems

actorid
Marc Zinnschlag 11 years ago
parent 5b5069535e
commit 5d422fec8a

@ -6,6 +6,7 @@
CSVWorld::SceneTool::SceneTool (SceneToolbar *parent) : QPushButton (parent) CSVWorld::SceneTool::SceneTool (SceneToolbar *parent) : QPushButton (parent)
{ {
setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed)); setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed));
setIconSize (QSize (parent->getIconSize(), parent->getIconSize()));
setFixedSize (parent->getButtonSize(), parent->getButtonSize()); setFixedSize (parent->getButtonSize(), parent->getButtonSize());
connect (this, SIGNAL (clicked()), this, SLOT (openRequest())); connect (this, SIGNAL (clicked()), this, SLOT (openRequest()));

@ -6,7 +6,7 @@
#include "scenetool.hpp" #include "scenetool.hpp"
CSVWorld::SceneToolbar::SceneToolbar (int buttonSize, QWidget *parent) CSVWorld::SceneToolbar::SceneToolbar (int buttonSize, QWidget *parent)
: QWidget (parent), mButtonSize (buttonSize) : QWidget (parent), mButtonSize (buttonSize), mIconSize (buttonSize-8)
{ {
setFixedWidth (mButtonSize); setFixedWidth (mButtonSize);
@ -26,4 +26,9 @@ void CSVWorld::SceneToolbar::addTool (SceneTool *tool)
int CSVWorld::SceneToolbar::getButtonSize() const int CSVWorld::SceneToolbar::getButtonSize() const
{ {
return mButtonSize; return mButtonSize;
}
int CSVWorld::SceneToolbar::getIconSize() const
{
return mIconSize;
} }

@ -15,6 +15,7 @@ namespace CSVWorld
QVBoxLayout *mLayout; QVBoxLayout *mLayout;
int mButtonSize; int mButtonSize;
int mIconSize;
public: public:
@ -23,6 +24,8 @@ namespace CSVWorld
void addTool (SceneTool *tool); void addTool (SceneTool *tool);
int getButtonSize() const; int getButtonSize() const;
int getIconSize() const;
}; };
} }

@ -8,7 +8,7 @@
#include "scenetoolbar.hpp" #include "scenetoolbar.hpp"
CSVWorld::SceneToolMode::SceneToolMode (SceneToolbar *parent) CSVWorld::SceneToolMode::SceneToolMode (SceneToolbar *parent)
: SceneTool (parent), mButtonSize (parent->getButtonSize()) : SceneTool (parent), mButtonSize (parent->getButtonSize()), mIconSize (parent->getIconSize())
{ {
mPanel = new QFrame (this, Qt::Popup); mPanel = new QFrame (this, Qt::Popup);
@ -29,6 +29,7 @@ void CSVWorld::SceneToolMode::addButton (const std::string& icon, const std::str
{ {
QPushButton *button = new QPushButton (QIcon (QPixmap (icon.c_str())), "", mPanel); QPushButton *button = new QPushButton (QIcon (QPixmap (icon.c_str())), "", mPanel);
button->setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed)); button->setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed));
button->setIconSize (QSize (mIconSize, mIconSize));
button->setFixedSize (mButtonSize, mButtonSize); button->setFixedSize (mButtonSize, mButtonSize);
mLayout->addWidget (button); mLayout->addWidget (button);

@ -20,6 +20,7 @@ namespace CSVWorld
QHBoxLayout *mLayout; QHBoxLayout *mLayout;
std::map<QPushButton *, std::string> mButtons; // widget, id std::map<QPushButton *, std::string> mButtons; // widget, id
int mButtonSize; int mButtonSize;
int mIconSize;
public: public:

Loading…
Cancel
Save