forked from mixxxdj/mixxx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
force waveformwidgetfactory events from library tableview
- Loading branch information
Showing
12 changed files
with
104 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include "library/defaultdelegate.h" | ||
|
||
#include <QCoreApplication> | ||
#include <QPainter> | ||
|
||
#include "mixxxapplication.h" | ||
#include "moc_defaultdelegate.cpp" | ||
|
||
DefaultDelegate::DefaultDelegate(QTableView* pTableView) | ||
: QStyledItemDelegate(pTableView), m_pTableView(pTableView) { | ||
} | ||
|
||
void DefaultDelegate::paint( | ||
QPainter* painter, | ||
const QStyleOptionViewItem& option, | ||
const QModelIndex& index) const { | ||
processTimeSensitiveEvents(painter); | ||
QStyledItemDelegate::paint(painter, option, index); | ||
} | ||
|
||
void DefaultDelegate::processTimeSensitiveEvents(QPainter* painter) const { | ||
// Drawing the table can be slow, resulting in time sensitive events not | ||
// being delivered in time. (The WaveformWidgetFactory not receiving its | ||
// render and swap signals in time). We force processing these events | ||
// during the drawing of the table cells to fix this. | ||
auto app = qobject_cast<MixxxApplication*>(QCoreApplication::instance()); | ||
if (app->hasTimeSensitiveEvents()) { | ||
QPaintDevice* device = painter->device(); | ||
if (device) { | ||
painter->end(); | ||
} | ||
app->processTimeSensitiveEvents(); | ||
if (device) { | ||
painter->begin(device); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
#include <QStyledItemDelegate> | ||
#include <QTableView> | ||
|
||
class DefaultDelegate : public QStyledItemDelegate { | ||
Q_OBJECT | ||
public: | ||
explicit DefaultDelegate( | ||
QTableView* pTableView); | ||
~DefaultDelegate() override = default; | ||
|
||
void paint( | ||
QPainter* painter, | ||
const QStyleOptionViewItem& option, | ||
const QModelIndex& index) const override; | ||
|
||
protected: | ||
void processTimeSensitiveEvents(QPainter* painter) const; | ||
|
||
QTableView* m_pTableView; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters