Rubberband fix for selecting large area in Songeditor (#5003)

This commit is contained in:
Steffen Baranowsky
2019-10-07 18:13:44 +02:00
committed by GitHub
parent 16390f61a5
commit 5aa87886c9
6 changed files with 218 additions and 85 deletions

View File

@@ -75,6 +75,9 @@ public:
public slots:
void scrolled( int new_pos );
void selectRegionFromPixels(int xStart, int xEnd);
void stopSelectRegion();
void updateRubberband();
void setEditMode( EditMode mode );
void setEditModeDraw();
@@ -85,6 +88,9 @@ public slots:
protected:
virtual void closeEvent( QCloseEvent * ce );
virtual void mousePressEvent(QMouseEvent * me);
virtual void mouseMoveEvent(QMouseEvent * me);
virtual void mouseReleaseEvent(QMouseEvent * me);
private slots:
void setHighQuality( bool );
@@ -109,6 +115,9 @@ private:
virtual bool allowRubberband() const;
int trackIndexFromSelectionPoint(int yPos);
int indexOfTrackView(const TrackView* tv);
Song * m_song;
@@ -135,6 +144,14 @@ private:
bool m_smoothScroll;
EditMode m_mode;
QPoint m_origin;
QPoint m_scrollPos;
QPoint m_mousePos;
int m_rubberBandStartTrackview;
MidiTime m_rubberbandStartMidipos;
int m_currentZoomingValue;
int m_trackHeadWidth;
bool m_selectRegion;
friend class SongEditorWindow;

View File

@@ -210,6 +210,12 @@ public:
{
return m_tco;
}
inline TrackView * getTrackView()
{
return m_trackView;
}
// qproperty access func
QColor mutedColor() const;
QColor mutedBackgroundColor() const;
@@ -229,7 +235,7 @@ public:
// access needsUpdate member variable
bool needsUpdate();
void setNeedsUpdate( bool b );
public slots:
virtual bool close();
void cut();
@@ -256,10 +262,6 @@ protected:
float pixelsPerTact();
inline TrackView * getTrackView()
{
return m_trackView;
}
DataFile createTCODataFiles(const QVector<TrackContentObjectView *> & tcos) const;

View File

@@ -133,27 +133,21 @@ public slots:
virtual void dropEvent( QDropEvent * _de );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
///
/// \brief selectRegionFromPixels
/// \param x
/// \param y
/// Use the rubber band to select TCO from all tracks using x, y pixels
void selectRegionFromPixels(int xStart, int xEnd);
///
/// \brief stopRubberBand
/// Removes the rubber band from display when finished with.
void stopRubberBand();
protected:
static const int DEFAULT_PIXELS_PER_TACT = 16;
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void resizeEvent( QResizeEvent * );
MidiTime m_currentPosition;
RubberBand *rubberBand() const;
private:
@@ -187,7 +181,7 @@ private:
float m_ppt;
RubberBand * m_rubberBand;
QPoint m_origin;
signals: