setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- // breaks with Qt 4.8
- if (QString("4.8.0") > qVersion()) // FIXME breaks with Qt versions >= 4.10!
- setAnimated(true);
+ setAnimated(true);
// FIXME This is to workaround bug #663
setUniformRowHeights(true);
}
if (model()) {
- disconnect(this, 0, model(), 0);
- disconnect(model(), 0, this, 0);
+ disconnect(this, nullptr, model(), nullptr);
+ disconnect(model(), nullptr, this, nullptr);
}
if (!model_) {
return;
if (_config) {
- disconnect(_config, 0, this, 0);
+ disconnect(_config, nullptr, this, nullptr);
}
_config = config;
return TreeViewTouch::dropEvent(event);
// Confirm that the user really wants to merge the buffers before doing so
- int res = QMessageBox::question(0, tr("Merge buffers permanently?"),
+ int res = QMessageBox::question(nullptr, tr("Merge buffers permanently?"),
tr("Do you want to merge the buffer \"%1\" permanently into buffer \"%2\"?\n This cannot be reversed!").arg(Client::networkModel()->bufferName(bufferId2)).arg(Client::networkModel()->bufferName(bufferId1)),
QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
if (res == QMessageBox::Yes) {
storeExpandedState(networkIdx); // this call is needed to keep track of the isActive state
}
-#if QT_VERSION < 0x050000
-void BufferView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
-{
- TreeViewTouch::dataChanged(topLeft, bottomRight);
-#else
void BufferView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles)
{
TreeViewTouch::dataChanged(topLeft, bottomRight, roles);
-#endif
// determine how many items have been changed and if any of them is a networkitem
// which just swichted from active to inactive or vice versa
config()->requestRemoveBuffer(bufferId);
}
-void BufferView::filterTextChanged(QString filterString)
+void BufferView::filterTextChanged(const QString& filterString)
{
BufferViewFilter *filter = qobject_cast<BufferViewFilter *>(model());
if (!filter) {
}
-void BufferView::changeHighlight(const BufferView::Direction direction)
+void BufferView::changeHighlight(BufferView::Direction direction)
{
// If for some weird reason we get a new delegate
- BufferViewDelegate *delegate = qobject_cast<BufferViewDelegate*>(itemDelegate(m_currentHighlight));
+ BufferViewDelegate *delegate = qobject_cast<BufferViewDelegate*>(itemDelegate(_currentHighlight));
if (delegate) {
delegate->currentHighlight = QModelIndex();
}
- QModelIndex newIndex = m_currentHighlight;
+ QModelIndex newIndex = _currentHighlight;
if (!newIndex.isValid()) {
newIndex = model()->index(0, 0);
}
return;
}
- m_currentHighlight = newIndex;
+ _currentHighlight = newIndex;
- delegate = qobject_cast<BufferViewDelegate*>(itemDelegate(m_currentHighlight));
+ delegate = qobject_cast<BufferViewDelegate*>(itemDelegate(_currentHighlight));
if (delegate) {
- delegate->currentHighlight = m_currentHighlight;
+ delegate->currentHighlight = _currentHighlight;
}
viewport()->update();
}
void BufferView::selectHighlighted()
{
- if (m_currentHighlight.isValid()) {
- selectionModel()->setCurrentIndex(m_currentHighlight, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
- selectionModel()->select(m_currentHighlight, QItemSelectionModel::ClearAndSelect);
+ if (_currentHighlight.isValid()) {
+ selectionModel()->setCurrentIndex(_currentHighlight, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
+ selectionModel()->select(_currentHighlight, QItemSelectionModel::ClearAndSelect);
} else {
selectFirstBuffer();
}
void BufferView::clearHighlight()
{
// If for some weird reason we get a new delegate
- BufferViewDelegate *delegate = qobject_cast<BufferViewDelegate*>(itemDelegate(m_currentHighlight));
+ BufferViewDelegate *delegate = qobject_cast<BufferViewDelegate*>(itemDelegate(_currentHighlight));
if (delegate) {
delegate->currentHighlight = QModelIndex();
}
- m_currentHighlight = QModelIndex();
+ _currentHighlight = QModelIndex();
viewport()->update();
}
// ****************************************
-// BufferViewDelgate
+// BufferViewDelegate
// ****************************************
class ColorsChangedEvent : public QEvent
{
if (!value.isValid())
return QStyledItemDelegate::editorEvent(event, model, option, index);
-#if QT_VERSION < 0x050000
- QStyleOptionViewItemV4 viewOpt(option);
-#else
QStyleOptionViewItem viewOpt(option);
-#endif
initStyleOption(&viewOpt, index);
QRect checkRect = viewOpt.widget->style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &viewOpt, viewOpt.widget);
// ==============================
BufferViewDock::BufferViewDock(BufferViewConfig *config, QWidget *parent)
: QDockWidget(parent),
- _childWidget(0),
+ _childWidget(nullptr),
_widget(new QWidget(parent)),
_filterEdit(new QLineEdit(parent)),
_active(false),
void BufferViewDock::setLocked(bool locked) {
if (locked) {
- setFeatures(0);
+ setFeatures(nullptr);
}
else {
setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
{
if (_oldFocusItem) {
_oldFocusItem->setFocus();
- _oldFocusItem = 0;
+ _oldFocusItem = nullptr;
}
if (!config()->showSearch()) {
{
BufferView *view = bufferView();
if (!view)
- return 0;
+ return nullptr;
else
return view->config();
}