|
|
@ -392,14 +392,15 @@ void TableViewLastColumnResizingFixer::connectViewHeadersSignals() |
|
|
|
connect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged())); |
|
|
|
connect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//we need to disconnect these while handling the resize events, otherwise we can enter infinite loops
|
|
|
|
// We need to disconnect these while handling the resize events, otherwise we can enter infinite loops.
|
|
|
|
void TableViewLastColumnResizingFixer::disconnectViewHeadersSignals() |
|
|
|
void TableViewLastColumnResizingFixer::disconnectViewHeadersSignals() |
|
|
|
{ |
|
|
|
{ |
|
|
|
disconnect(tableView->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(on_sectionResized(int,int,int))); |
|
|
|
disconnect(tableView->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(on_sectionResized(int,int,int))); |
|
|
|
disconnect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged())); |
|
|
|
disconnect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//setup the resize mode, handles compatibility for QT5 and below as the method signatures changed. (refactored here for readability)
|
|
|
|
// Setup the resize mode, handles compatibility for Qt5 and below as the method signatures changed.
|
|
|
|
|
|
|
|
// Refactored here for readability.
|
|
|
|
void TableViewLastColumnResizingFixer::setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode) |
|
|
|
void TableViewLastColumnResizingFixer::setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
#if QT_VERSION < 0x050000 |
|
|
|
#if QT_VERSION < 0x050000 |
|
|
@ -409,7 +410,8 @@ void TableViewLastColumnResizingFixer::setViewHeaderResizeMode(int logicalIndex, |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void TableViewLastColumnResizingFixer::resizeColumn(int nColumnIndex, int width) { |
|
|
|
void TableViewLastColumnResizingFixer::resizeColumn(int nColumnIndex, int width) |
|
|
|
|
|
|
|
{ |
|
|
|
tableView->setColumnWidth(nColumnIndex, width); |
|
|
|
tableView->setColumnWidth(nColumnIndex, width); |
|
|
|
tableView->horizontalHeader()->resizeSection(nColumnIndex, width); |
|
|
|
tableView->horizontalHeader()->resizeSection(nColumnIndex, width); |
|
|
|
} |
|
|
|
} |
|
|
@ -438,7 +440,7 @@ int TableViewLastColumnResizingFixer::getAvailableWidthForColumn(int column) |
|
|
|
return nResult; |
|
|
|
return nResult; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//make sure we don't make the columns wider than the table's viewport's width.
|
|
|
|
// Make sure we don't make the columns wider than the tables viewport width.
|
|
|
|
void TableViewLastColumnResizingFixer::adjustTableColumnsWidth() |
|
|
|
void TableViewLastColumnResizingFixer::adjustTableColumnsWidth() |
|
|
|
{ |
|
|
|
{ |
|
|
|
disconnectViewHeadersSignals(); |
|
|
|
disconnectViewHeadersSignals(); |
|
|
@ -453,14 +455,15 @@ void TableViewLastColumnResizingFixer::adjustTableColumnsWidth() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//make column use all the space available, useful during window resizing.
|
|
|
|
// Make column use all the space available, useful during window resizing.
|
|
|
|
void TableViewLastColumnResizingFixer::stretchColumnWidth(int column) { |
|
|
|
void TableViewLastColumnResizingFixer::stretchColumnWidth(int column) |
|
|
|
|
|
|
|
{ |
|
|
|
disconnectViewHeadersSignals(); |
|
|
|
disconnectViewHeadersSignals(); |
|
|
|
resizeColumn(column, getAvailableWidthForColumn(column)); |
|
|
|
resizeColumn(column, getAvailableWidthForColumn(column)); |
|
|
|
connectViewHeadersSignals(); |
|
|
|
connectViewHeadersSignals(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//when a section is resized this is a slot-proxy for ajustAmountColumnWidth()
|
|
|
|
// When a section is resized this is a slot-proxy for ajustAmountColumnWidth().
|
|
|
|
void TableViewLastColumnResizingFixer::on_sectionResized(int logicalIndex, int oldSize, int newSize) |
|
|
|
void TableViewLastColumnResizingFixer::on_sectionResized(int logicalIndex, int oldSize, int newSize) |
|
|
|
{ |
|
|
|
{ |
|
|
|
adjustTableColumnsWidth(); |
|
|
|
adjustTableColumnsWidth(); |
|
|
@ -471,7 +474,7 @@ void TableViewLastColumnResizingFixer::on_sectionResized(int logicalIndex, int o |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//when the table's geometry is ready, we manually perform the Stretch of the "Message" column
|
|
|
|
// When the tabless geometry is ready, we manually perform the stretch of the "Message" column,
|
|
|
|
// as the "Stretch" resize mode does not allow for interactive resizing.
|
|
|
|
// as the "Stretch" resize mode does not allow for interactive resizing.
|
|
|
|
void TableViewLastColumnResizingFixer::on_geometriesChanged() |
|
|
|
void TableViewLastColumnResizingFixer::on_geometriesChanged() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -500,7 +503,6 @@ TableViewLastColumnResizingFixer::TableViewLastColumnResizingFixer(QTableView* t |
|
|
|
setViewHeaderResizeMode(lastColumnIndex, QHeaderView::Interactive); |
|
|
|
setViewHeaderResizeMode(lastColumnIndex, QHeaderView::Interactive); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef WIN32 |
|
|
|
#ifdef WIN32 |
|
|
|
boost::filesystem::path static StartupShortcutPath() |
|
|
|
boost::filesystem::path static StartupShortcutPath() |
|
|
|
{ |
|
|
|
{ |
|
|
|