Commit eae70bae authored by Scott Wheeler's avatar Scott Wheeler

Yet another subclass to cover a special case. Added a QHBoxLayout subclass

that allows the width to be fixed to a certain minimum and used that for
the column that tends to change size based on the selection.

CCMAIL:70814-done@bugs.kde.org

svn path=/trunk/kdemultimedia/juk/; revision=303500
parent 03511ab4
......@@ -72,12 +72,36 @@ private:
TagEditor *m_editor;
};
class FixedHLayout : public QHBoxLayout
{
public:
FixedHLayout(QWidget *parent, int margin = 0, int spacing = -1, const char *name = 0) :
QHBoxLayout(parent, margin, spacing, name),
m_width(-1) {}
FixedHLayout(QLayout *parentLayout, int spacing = -1, const char *name = 0) :
QHBoxLayout(parentLayout, spacing, name),
m_width(-1) {}
void setWidth(int w = -1)
{
m_width = w == -1 ? QHBoxLayout::minimumSize().width() : w;
}
virtual QSize minimumSize() const
{
QSize s = QHBoxLayout::minimumSize();
s.setWidth(m_width);
return s;
}
private:
int m_width;
};
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
TagEditor::TagEditor(QWidget *parent, const char *name) : QWidget(parent, name),
m_currentPlaylist(0)
TagEditor::TagEditor(QWidget *parent, const char *name) :
QWidget(parent, name),
m_currentPlaylist(0)
{
setupLayout();
readConfig();
......@@ -384,7 +408,7 @@ void TagEditor::setupLayout()
{ // just for organization
QHBoxLayout *fileNameLayout = new QHBoxLayout(rightColumnLayout,
horizontalSpacing);
horizontalSpacing);
m_fileNameBox = new KLineEdit(this, "fileNameBox");
m_fileNameBox->setValidator(new FileNameValidator(m_fileNameBox));
......@@ -401,8 +425,8 @@ void TagEditor::setupLayout()
rightColumnLayout->addWidget(addHidden(m_fileNameBox));
{ // lay out the track row
QHBoxLayout *trackRowLayout = new QHBoxLayout(rightColumnLayout,
horizontalSpacing);
FixedHLayout *trackRowLayout = new FixedHLayout(rightColumnLayout,
horizontalSpacing);
m_trackSpin = new KIntSpinBox(0, 255, 1, 0, 10, this, "trackSpin");
addItem(i18n("T&rack:"), m_trackSpin, trackRowLayout);
......@@ -436,6 +460,8 @@ void TagEditor::setupLayout()
m_bitrateBox->setAlignment(Qt::AlignRight);
m_bitrateBox->setReadOnly(true);
trackRowLayout->addWidget(addHidden(m_bitrateBox));
trackRowLayout->setWidth();
}
m_commentBox = new KEdit(this, "commentBox");
......
......@@ -70,7 +70,6 @@ private:
QWidget *addHidden(QWidget *w) { m_hideList.append(w); return w; }
virtual void showEvent(QShowEvent *e);
virtual bool eventFilter(QObject *watched, QEvent *e);
private slots:
......@@ -99,7 +98,7 @@ private:
PlaylistItemList m_items;
Playlist *m_currentPlaylist;
bool m_dataChanged;
bool m_dataChanged;
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment