Uploaded image for project: 'Qt Solutions'
  1. Qt Solutions
  2. QTSOLBUG-73

When pressing an arrow key in a QLineEdit hosted in a Windows Forms window will cause the focus to change

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • None
    • WinForms Interop
    • None

    Description

      When pressing an arrow key in a QLineEdit hosted in a Windows Forms window will cause the focus to change, whereas it should navigate within the text for the QLineEdit

      Patch to reproduce the problem:

      ==== //depot/addons/main/windows/qtwinforms/examples/qtclock/mainwindow.cpp#6 - c:\work\depot\addons\main\windows\qtwinforms\
      examples\qtclock\mainwindow.cpp ====
      @@ -1,14 +1,16 @@
      +#include <QLineEdit>
      +
       #include "mainwindow.h"
      
       MainWindow::MainWindow()
       {
           SuspendLayout();
      -
      +
           clock = new AnalogClock();
           clockHost = gcnew QtWidgetHost(clock);
           clockHost->Anchor = AnchorStyles::None;
           clockHost->Dock = DockStyle::Fill;
      -
      +
           timePicker = gcnew DateTimePicker();
           timePicker->Anchor = AnchorStyles::Right;
           timePicker->ShowUpDown = true;
      @@ -19,7 +21,10 @@
           button->Anchor = AnchorStyles::Left;
           button->Text = L"Set time";
           button->Click += gcnew System::EventHandler(this, &MainWindow::button_Click);
      -
      +
      +    QLineEdit* lineEdit = new QLineEdit();
      +    QtWidgetHost^ lineEditHost = gcnew QtWidgetHost(lineEdit);
      +
           TableLayoutPanel ^layout = gcnew TableLayoutPanel();
           layout->SuspendLayout();
           layout->Dock = DockStyle::Fill;
      @@ -33,7 +38,8 @@
           layout->SetColumnSpan(clockHost, 2);
           layout->Controls->Add(timePicker, 0, 1);
           layout->Controls->Add(button, 1, 1);
      -
      +    layout->Controls->Add(lineEditHost, 1, 2);
      +
           Controls->Add(layout);
           layout->ResumeLayout(false);
           ResumeLayout(false);
      

      Attachments

        Issue Links

          Activity

            People

              vgt Eirik Aavitsland
              anshaw Andy Shaw (closed Nokia identity) (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: