mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-21 12:26:11 +00:00
Additional parameters for adjustColumns
- Add columnCount and padding parameter - Remove unnecessary functions
This commit is contained in:
parent
9931d6f484
commit
ad0de05654
@ -44,12 +44,17 @@ namespace qhelpers
|
|||||||
return QFileInfo(filename).fileName() + "_" + fullHash.toHex().left(10);
|
return QFileInfo(filename).fileName() + "_" + fullHash.toHex().left(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void adjustColumns(QTreeWidget *tw)
|
void adjustColumns(QTreeWidget *tw, int columnCount, int padding)
|
||||||
{
|
{
|
||||||
int count = tw->columnCount();
|
const int count = columnCount == 0 ? tw->columnCount() : columnCount;
|
||||||
for (int i = 0; i != count; ++i)
|
for (int i = 0; i != count; ++i)
|
||||||
{
|
{
|
||||||
tw->resizeColumnToContents(i);
|
tw->resizeColumnToContents(i);
|
||||||
|
if (padding > 0)
|
||||||
|
{
|
||||||
|
int width = tw->columnWidth(i);
|
||||||
|
tw->setColumnWidth(i, width + padding);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ namespace qhelpers
|
|||||||
|
|
||||||
QString uniqueProjectName(const QString &filename);
|
QString uniqueProjectName(const QString &filename);
|
||||||
|
|
||||||
void adjustColumns(QTreeWidget *tw);
|
void adjustColumns(QTreeWidget *tw, int columnCount = 0, int padding = 0);
|
||||||
|
|
||||||
void appendRow(QTreeWidget *tw, const QString &str, const QString &str2 = QString(),
|
void appendRow(QTreeWidget *tw, const QString &str, const QString &str2 = QString(),
|
||||||
const QString &str3 = QString(), const QString &str4 = QString(), const QString &str5 = QString());
|
const QString &str3 = QString(), const QString &str4 = QString(), const QString &str5 = QString());
|
||||||
|
@ -76,7 +76,7 @@ void ImportsWidget::fillImports()
|
|||||||
qhelpers::appendRow(ui->importsTreeWidget, a[1], a[3], "", a[4]);
|
qhelpers::appendRow(ui->importsTreeWidget, a[1], a[3], "", a[4]);
|
||||||
}
|
}
|
||||||
highlightUnsafe();
|
highlightUnsafe();
|
||||||
qhelpers::adjustColumns(ui->importsTreeWidget);
|
qhelpers::adjustColumns(ui->importsTreeWidget, 0, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportsWidget::highlightUnsafe()
|
void ImportsWidget::highlightUnsafe()
|
||||||
@ -110,15 +110,3 @@ void ImportsWidget::setScrollMode()
|
|||||||
{
|
{
|
||||||
qhelpers::setVerticalScrollMode(ui->importsTreeWidget);
|
qhelpers::setVerticalScrollMode(ui->importsTreeWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportsWidget::adjustColumns(QTreeWidget *tw)
|
|
||||||
{
|
|
||||||
// WARNING: was this ever called.. compare to master
|
|
||||||
int count = tw->columnCount();
|
|
||||||
for (int i = 0; i != count; ++i)
|
|
||||||
{
|
|
||||||
ui->importsTreeWidget->resizeColumnToContents(i);
|
|
||||||
int width = ui->importsTreeWidget->columnWidth(i);
|
|
||||||
ui->importsTreeWidget->setColumnWidth(i, width + 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -31,7 +31,6 @@ private:
|
|||||||
void fillImports();
|
void fillImports();
|
||||||
void highlightUnsafe();
|
void highlightUnsafe();
|
||||||
void setScrollMode();
|
void setScrollMode();
|
||||||
void adjustColumns(QTreeWidget *tw);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMyDelegate : public QStyledItemDelegate
|
class CMyDelegate : public QStyledItemDelegate
|
||||||
|
@ -105,12 +105,3 @@ void SectionsWidget::fillSections(int row, const QString &str, const QString &st
|
|||||||
tempItem->setData(0, Qt::DecorationRole, colors[row % colors.size()]);
|
tempItem->setData(0, Qt::DecorationRole, colors[row % colors.size()]);
|
||||||
this->tree->insertTopLevelItem(0, tempItem);
|
this->tree->insertTopLevelItem(0, tempItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SectionsWidget::adjustColumns()
|
|
||||||
{
|
|
||||||
int count = 4;
|
|
||||||
for (int i = 0; i != count; ++i)
|
|
||||||
{
|
|
||||||
this->tree->resizeColumnToContents(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -33,7 +33,6 @@ private:
|
|||||||
|
|
||||||
void fillSections(int row, const QString &str, const QString &str2 = QString(),
|
void fillSections(int row, const QString &str, const QString &str2 = QString(),
|
||||||
const QString &str3 = QString(), const QString &str4 = QString());
|
const QString &str3 = QString(), const QString &str4 = QString());
|
||||||
void adjustColumns();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SECTIONSWIDGET_H
|
#endif // SECTIONSWIDGET_H
|
||||||
|
Loading…
Reference in New Issue
Block a user