mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 11:52:25 +00:00
Bug fixes from Ugras Baran:
when iconpalette detached from the math dialog, the iconpalette widget width may become too large to fit to the screen. when detached resized to a too small size, icons overlap. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15966 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
34a773b8cf
commit
eea50a7542
@ -224,12 +224,15 @@ void QMathDialog::expandClicked()
|
|||||||
{
|
{
|
||||||
int const id = symbolsCO->currentIndex();
|
int const id = symbolsCO->currentIndex();
|
||||||
IconPalette * p = makePanel(0, panels[id]);
|
IconPalette * p = makePanel(0, panels[id]);
|
||||||
|
p->setFixedWidth(40 * 15 + 20);
|
||||||
string s = "LyX: ";
|
string s = "LyX: ";
|
||||||
s += fromqstr(symbolsCO->currentText());
|
s += fromqstr(symbolsCO->currentText());
|
||||||
p->setWindowTitle(toqstr(s));
|
p->setWindowTitle(toqstr(s));
|
||||||
p->resize(40 * 5, p->height());
|
p->resize(40 * 5, p->height());
|
||||||
p->show();
|
p->show();
|
||||||
p->setMaximumSize(p->width(), p->height());
|
p->resize(40 * 5 + 20, 40 * p->numRows() + 20);
|
||||||
|
p->setMinimumSize(40 * 5 + 20, 40 * 1 + 20);
|
||||||
|
p->setMaximumWidth (40 * p->numButtons() + 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ void IconPalette::resizeEvent(QResizeEvent * e)
|
|||||||
|
|
||||||
int cols = max(width() / button_size, 1);
|
int cols = max(width() / button_size, 1);
|
||||||
int rows = max(int(buttons_.size() / cols), 1);
|
int rows = max(int(buttons_.size() / cols), 1);
|
||||||
if (buttons_.size() % cols)
|
if (buttons_.size() % cols )
|
||||||
++rows;
|
++rows;
|
||||||
|
|
||||||
lyxerr[Debug::GUI] << "Laying out " << buttons_.size() << " widgets in a "
|
lyxerr[Debug::GUI] << "Laying out " << buttons_.size() << " widgets in a "
|
||||||
@ -121,7 +121,13 @@ void IconPalette::resizeEvent(QResizeEvent * e)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
||||||
resize(cols * button_size, rows * button_size);
|
int maxrow_ = int(buttons_.size() / cols);
|
||||||
|
if (!maxrow_ || buttons_.size() % cols )
|
||||||
|
++maxrow_;
|
||||||
|
if(!parent())
|
||||||
|
setMinimumHeight(button_size * maxrow_ + 20); //prevents the detached panel becomes unreadable
|
||||||
|
else
|
||||||
|
resize(cols * button_size, rows * button_size);
|
||||||
|
|
||||||
maxcol_ = cols;
|
maxcol_ = cols;
|
||||||
|
|
||||||
@ -129,6 +135,18 @@ out:
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int IconPalette::numRows()
|
||||||
|
{
|
||||||
|
return maxrow_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int IconPalette::numButtons()
|
||||||
|
{
|
||||||
|
return buttons_.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
|
||||||
|
@ -36,6 +36,11 @@ public:
|
|||||||
|
|
||||||
/// add a button
|
/// add a button
|
||||||
void add(QPixmap const & pixmap, std::string name, std::string tooltip);
|
void add(QPixmap const & pixmap, std::string name, std::string tooltip);
|
||||||
|
/// get required number of rows.
|
||||||
|
int numRows();
|
||||||
|
/// get number of Buttons
|
||||||
|
int numButtons();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void button_clicked(const std::string &);
|
void button_clicked(const std::string &);
|
||||||
protected:
|
protected:
|
||||||
@ -45,6 +50,8 @@ protected Q_SLOTS:
|
|||||||
private:
|
private:
|
||||||
int maxcol_;
|
int maxcol_;
|
||||||
|
|
||||||
|
int maxrow_;
|
||||||
|
|
||||||
QGridLayout * layout_;
|
QGridLayout * layout_;
|
||||||
|
|
||||||
typedef std::pair<QPushButton *, std::string> Button;
|
typedef std::pair<QPushButton *, std::string> Button;
|
||||||
|
Loading…
Reference in New Issue
Block a user