Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef LINEEDIT_H
Toshihiro Shimizu 890ddd
#define LINEEDIT_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <qlineedit></qlineedit>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TOONZQT_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
namespace DVGui {
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
/*! \brief It is a \b QLineEdit which lost focus when enter is pressed and emit
Shinya Kitaoka 120a6e
                                         focusIn signal when line edit take
Shinya Kitaoka 120a6e
   focus.
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
                Inherits \b QLineEdit.
Toshihiro Shimizu 890ddd
*/
Shinya Kitaoka 120a6e
class DVAPI LineEdit : public QLineEdit {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool m_isReturnPressed;
Shinya Kitaoka 120a6e
  bool m_forbiddenSpecialChars;
Jeremy Bullock 771290
  bool m_mouseDragEditing = false;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  LineEdit(QWidget *parent = 0, bool forbiddenSpecialChars = false);
Shinya Kitaoka 120a6e
  LineEdit(const QString &contents, QWidget *parent = 0,
Shinya Kitaoka 120a6e
           bool forbiddenSpecialChars = false);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool isReturnPressed() const { return m_isReturnPressed; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ~LineEdit() {}
Toshihiro Shimizu 890ddd
Jeremy Bullock 771290
  // In the function editor, ctrl + dragging on the lineedit
Jeremy Bullock 771290
  // can adjust the value.
Jeremy Bullock 771290
  bool getMouseDragEditing() { return m_mouseDragEditing; }
Jeremy Bullock 771290
  void setMouseDragEditing(bool status) { m_mouseDragEditing = status; }
Jeremy Bullock 771290
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void focusInEvent(QFocusEvent *event) override;
Shinya Kitaoka 473e70
  void keyPressEvent(QKeyEvent *event) override;
Jeremy Bullock 771290
  void mouseMoveEvent(QMouseEvent *) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
signals:
Shinya Kitaoka 120a6e
  void focusIn();
Jeremy Bullock f3ea7c
  void returnPressedNow();
Jeremy Bullock 771290
  // this signal is only used for mouse drag value editing in the function
Jeremy Bullock 771290
  // panel.
Jeremy Bullock 771290
  void mouseMoved(QMouseEvent *);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Shinya Kitaoka 120a6e
}  // namespace DVGui
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // LINEEDIT_H