[Qt-interest] QLineEdit on Macintosh beeps

John Weeks john at wavemetrics.com
Fri Apr 9 20:06:06 CEST 2010


I have a QLineEdit as a child of a window derived from QWidget, and  
residing in a QHBoxLayout. On Macintosh, using the Cocoa Qt 4.6.1 a  
beep sounds when I press return. On Windows, this doesn't happen.

It's a vanilla QLineEdit created in Designer:

         CommandLineHLayout = new QHBoxLayout();
         CommandLineHLayout->setSpacing(0);
         CommandLineHLayout- 
 >setObjectName(QString::fromUtf8("CommandLineHLayout"));
         commandLine = new QLineEdit(CommandWindow);
         commandLine->setObjectName(QString::fromUtf8("commandLine"));

         CommandLineHLayout->addWidget(commandLine);

I created a slot to handle the returnPressed signal:

void CommandWindow::commandReturnPressed(void)
{
	if (commandLine->text().size() > 0)
	{
		QLineEditCommand cs(commandLine);
		if (!XLine(&cs))
		{
			PutResLine(commandLine->text(), true);
			commandLine->clear();
		}
	}
}

Most of this, of course, is peculiar to my application, but that  
doesn't matter because my problem occurs even when
	if (commandLine->text().size() > 0)
is false (so nothing happens).

Putting a breakpoint in commandReturnPressed I see that the beep is  
coming from [QCocoaView keyDown:], so it's not anything that Qt is  
doing for me. Has anyone else seen (or rather, heard) this problem? Is  
there a work-around or fix?

Thanks!
Regards, John Weeks




More information about the Qt-interest-old mailing list