Esempio n. 1
0
/**
 * Constructor
 * @param title :: The title
 * @param parent :: The parent widget
 * @param flags :: Window flags
 */
ScriptOutputDisplay::ScriptOutputDisplay(QWidget *parent)
    : QTextEdit(parent), m_copy(NULL), m_clear(NULL), m_save(NULL),
      m_origFontSize(8), m_zoomLevel(0) {
#ifdef __APPLE__
  // Make all fonts 4 points bigger on the Mac because otherwise they're tiny!
  m_zoomLevel += 4;
#endif

  // the control is readonly, but if you set it read only then ctrl+c for
  // copying does not work
  // this approach allows ctrl+c and disables user editing through the use of
  // the KeyPress handler
  // and disabling drag and drop
  // also the mouseMoveEventHandler prevents dragging out of the control
  // affecting the text.
  setReadOnly(false);
  this->setAcceptDrops(false);

  setLineWrapMode(QTextEdit::WidgetWidth);
  setLineWrapColumnOrWidth(105);
  setAutoFormatting(QTextEdit::AutoNone);
  // Change to fix width font so that table formatting isn't screwed up
  resetFont();

  setContextMenuPolicy(Qt::CustomContextMenu);
  connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this,
          SLOT(showContextMenu(const QPoint &)));

  initActions();
}
Esempio n. 2
0
void ChatView::markReceived(QString id)
{
	if (useMessageIcons_) {
		document()->addResource(QTextDocument::ImageResource, QUrl(QString("icon:delivery") + id), logIconDelivered);
		setLineWrapColumnOrWidth(lineWrapColumnOrWidth());
	}
}