Merge pull request #881 from manongjohn/fix_memo_color_change_crash
Fix memo style editor color change crash
This commit is contained in:
commit
5abed9786f
3 changed files with 35 additions and 23 deletions
|
@ -1687,8 +1687,7 @@ void XsheetViewer::resetXsheetNotes() {
|
||||||
void XsheetViewer::updateNoteWidgets() {
|
void XsheetViewer::updateNoteWidgets() {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < m_noteWidgets.size(); i++) m_noteWidgets.at(i)->update();
|
for (i = 0; i < m_noteWidgets.size(); i++) m_noteWidgets.at(i)->update();
|
||||||
m_noteArea->updatePopup();
|
if (XsheetGUI::NotePopupWidget) XsheetGUI::NotePopupWidget->update();
|
||||||
m_layerFooterPanel->m_noteArea->updatePopup();
|
|
||||||
updateCells();
|
updateCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,6 +166,10 @@ NotePopup::NotePopup(XsheetViewer *viewer, int noteIndex)
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void NotePopup::setCurrentViewer(XsheetViewer *viewer) { m_viewer = viewer; }
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void NotePopup::setCurrentNoteIndex(int index) { m_noteIndex = index; }
|
void NotePopup::setCurrentNoteIndex(int index) { m_noteIndex = index; }
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -426,14 +430,17 @@ void NoteWidget::paint(QPainter *painter, QPoint pos, bool isCurrent) {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void NoteWidget::openNotePopup() {
|
void NoteWidget::openNotePopup() {
|
||||||
if (!m_noteEditor) {
|
if (!NotePopupWidget)
|
||||||
m_noteEditor.reset(new XsheetGUI::NotePopup(m_viewer, m_noteIndex));
|
NotePopupWidget = new XsheetGUI::NotePopup(m_viewer, m_noteIndex);
|
||||||
|
else {
|
||||||
|
NotePopupWidget->setCurrentViewer(m_viewer);
|
||||||
|
NotePopupWidget->setCurrentNoteIndex(m_noteIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_noteEditor->isVisible()) {
|
if (NotePopupWidget->isVisible()) {
|
||||||
m_noteEditor->activateWindow();
|
NotePopupWidget->activateWindow();
|
||||||
} else {
|
} else {
|
||||||
m_noteEditor->show();
|
NotePopupWidget->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,13 +696,17 @@ void NoteArea::onXsheetOrientationChanged(const Orientation *newOrientation) {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void NoteArea::toggleNewNote() {
|
void NoteArea::toggleNewNote() {
|
||||||
if (!m_newNotePopup)
|
if (!NotePopupWidget)
|
||||||
m_newNotePopup.reset(new XsheetGUI::NotePopup(m_viewer, -1));
|
NotePopupWidget = new XsheetGUI::NotePopup(m_viewer, -1);
|
||||||
|
else {
|
||||||
|
NotePopupWidget->setCurrentViewer(m_viewer);
|
||||||
|
NotePopupWidget->setCurrentNoteIndex(-1);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_newNotePopup->isVisible()) {
|
if (NotePopupWidget->isVisible()) {
|
||||||
m_newNotePopup->activateWindow();
|
NotePopupWidget->activateWindow();
|
||||||
} else {
|
} else {
|
||||||
m_newNotePopup->show();
|
NotePopupWidget->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -872,13 +883,17 @@ void FooterNoteArea::onXsheetOrientationChanged(
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void FooterNoteArea::toggleNewNote() {
|
void FooterNoteArea::toggleNewNote() {
|
||||||
if (!m_newNotePopup)
|
if (!NotePopupWidget)
|
||||||
m_newNotePopup.reset(new XsheetGUI::NotePopup(m_viewer, -1));
|
NotePopupWidget = new XsheetGUI::NotePopup(m_viewer, -1);
|
||||||
|
else {
|
||||||
|
NotePopupWidget->setCurrentViewer(m_viewer);
|
||||||
|
NotePopupWidget->setCurrentNoteIndex(-1);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_newNotePopup->isVisible()) {
|
if (NotePopupWidget->isVisible()) {
|
||||||
m_newNotePopup->activateWindow();
|
NotePopupWidget->activateWindow();
|
||||||
} else {
|
} else {
|
||||||
m_newNotePopup->show();
|
NotePopupWidget->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ public:
|
||||||
NotePopup(XsheetViewer *viewer, int noteIndex);
|
NotePopup(XsheetViewer *viewer, int noteIndex);
|
||||||
~NotePopup() {}
|
~NotePopup() {}
|
||||||
|
|
||||||
|
void setCurrentViewer(XsheetViewer *viewer);
|
||||||
void setCurrentNoteIndex(int index);
|
void setCurrentNoteIndex(int index);
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
@ -82,6 +83,8 @@ protected slots:
|
||||||
void onXsheetSwitched();
|
void onXsheetSwitched();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static NotePopup *NotePopupWidget;
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// NoteWidget
|
// NoteWidget
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -90,7 +93,6 @@ class NoteWidget final : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
XsheetViewer *m_viewer;
|
XsheetViewer *m_viewer;
|
||||||
int m_noteIndex;
|
int m_noteIndex;
|
||||||
std::unique_ptr<NotePopup> m_noteEditor;
|
|
||||||
bool m_isHovered;
|
bool m_isHovered;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -99,7 +101,7 @@ public:
|
||||||
int getNoteIndex() const { return m_noteIndex; }
|
int getNoteIndex() const { return m_noteIndex; }
|
||||||
void setNoteIndex(int index) {
|
void setNoteIndex(int index) {
|
||||||
m_noteIndex = index;
|
m_noteIndex = index;
|
||||||
if (m_noteEditor) m_noteEditor->setCurrentNoteIndex(index);
|
if (NotePopupWidget) NotePopupWidget->setCurrentNoteIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void paint(QPainter *painter, QPoint pos = QPoint(), bool isCurrent = false);
|
void paint(QPainter *painter, QPoint pos = QPoint(), bool isCurrent = false);
|
||||||
|
@ -117,7 +119,6 @@ protected:
|
||||||
class NoteArea final : public QFrame {
|
class NoteArea final : public QFrame {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
std::unique_ptr<NotePopup> m_newNotePopup; // Popup used to create new note
|
|
||||||
XsheetViewer *m_viewer;
|
XsheetViewer *m_viewer;
|
||||||
|
|
||||||
// QPushButton *m_flipOrientationButton;
|
// QPushButton *m_flipOrientationButton;
|
||||||
|
@ -142,7 +143,6 @@ public:
|
||||||
NoteArea(XsheetViewer *parent = 0, Qt::WFlags flags = 0);
|
NoteArea(XsheetViewer *parent = 0, Qt::WFlags flags = 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void updatePopup() { m_newNotePopup->update(); }
|
|
||||||
void updateButtons();
|
void updateButtons();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
@ -168,7 +168,6 @@ protected:
|
||||||
class FooterNoteArea final : public QFrame {
|
class FooterNoteArea final : public QFrame {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
std::unique_ptr<NotePopup> m_newNotePopup; // Popup used to create new note
|
|
||||||
XsheetViewer *m_viewer;
|
XsheetViewer *m_viewer;
|
||||||
|
|
||||||
QToolButton *m_noteButton;
|
QToolButton *m_noteButton;
|
||||||
|
@ -183,7 +182,6 @@ public:
|
||||||
FooterNoteArea(XsheetViewer *parent = 0, Qt::WFlags flags = 0);
|
FooterNoteArea(XsheetViewer *parent = 0, Qt::WFlags flags = 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void updatePopup() { m_newNotePopup->update(); }
|
|
||||||
void updateButtons();
|
void updateButtons();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
Loading…
Reference in a new issue