<p>Hi!</p><p>I can't say anything about your patch in generally because I'm just not familiar with the internals of KDE yet ... but (and I don't know if it's your fault) why the hell is the size of the systray icons hardcoded?? (22px). Shouldn't there be a global setting for the icon size?</p>
<p>Best Regards,</p><p>Bernhard</p><br><div><span class="gmail_quote">2008/6/14, Mathias Kraus <<a href="mailto:k.matze@gmx.net">k.matze@gmx.net</a>>:</span><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br> <br> this is my first patch for KDE, so I hope I don't break plasma ;)<br> <br> OK, it's only a small patch for a layouting bug which occurs when you have a<br> system tray with multiple rows/columns. See attached picture.<br>
<br> The bug is in<br> kdebase/workspace/plasma/applets/systemtray/systemtraywidget.cpp.<br> In addWidgetToLayout the conditions in line 140<br> minimumHeight() + widget->height() + m_mainLayout->spacing() > maximumHeight()<br>
is always true after the first column is full, the same applies for a vertical<br> panel with rows.<br> <br> My patch calculates the maximum number of items that fits into the panel and<br> jumps into the next row/column if there is an overflow.<br>
<br> void SystemTrayWidget::addWidgetToLayout(QWidget *widget)<br> {<br> // Add the widget to the layout<br> m_mainLayout->setRowMinimumHeight(m_nextRow, 22);<br> m_mainLayout->setColumnMinimumWidth(m_nextColumn, 22);<br>
widget->resize(22,22);<br> m_mainLayout->addWidget(widget, m_nextRow, m_nextColumn, 1, 1,<br> Qt::AlignCenter);<br> <br> // Figure out where the next widget should go<br> if (m_orientation == Qt::Horizontal) {<br>
// Calculate the items that fit into a column<br> m_maxCount = (maximumHeight() + m_mainLayout->spacing()) / (widget-<br> >height() + m_mainLayout->spacing()) -1;<br> <br> setMinimumSize(QSize(22 * (m_nextColumn + 1) + m_mainLayout->spacing()<br>
* m_nextColumn,<br> 22 * (m_maxCount + 1) + m_mainLayout->spacing() *<br> m_maxCount));<br> <br> // Add down then across when horizontal<br> m_nextRow++;<br> if (m_nextRow > m_maxCount){<br>
m_nextColumn++;<br> m_nextRow = 0;<br> }<br> } else {<br> // Calculate the items that fit into a row<br> m_maxCount = (maximumWidth() + m_mainLayout->spacing()) / (widget-<br>
>width() + m_mainLayout->spacing()) -1;<br> <br> setMinimumSize(QSize(22 * (m_maxCount + 1) + m_mainLayout->spacing() *<br> m_maxCount,<br> 22 * (m_nextRow + 1) + m_mainLayout->spacing() *<br>
m_nextRow));<br> <br> // Add across then down when vertical<br> m_nextColumn++;<br> if (m_nextColumn > m_maxCount) {<br> m_nextRow++;<br> m_nextColumn = 0;<br> }<br> }<br>
}<br> <br> BTW you guys rock. Keep on the good work.<br> <br> Best regards,<br> <br>Mathias Kraus<br> <br> <br> <br>_______________________________________________<br> Panel-devel mailing list<br> <a href="mailto:Panel-devel@kde.org">Panel-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/panel-devel">https://mail.kde.org/mailman/listinfo/panel-devel</a><br> <br><br></blockquote></div><br>