السلام عليكم ورحمة الله وبركاته
هل من الاخوة من يملك كود لتغيير إعدادات لوحة المفاتيح مثلا للغة العربية عند تشغيل برنامج مبرمج ب Qt
وشكرا مسبقا
السلام عليكم ورحمة الله وبركاته
هل من الاخوة من يملك كود لتغيير إعدادات لوحة المفاتيح مثلا للغة العربية عند تشغيل برنامج مبرمج ب Qt
وشكرا مسبقا
بحثت قليلا فلم اجد فى QT ما يفى بهذا الغرض
فى النهاية استخدمت WIN API وطبعا هى تعمل على انظمة الويندوز فقط
هذا الكود
#include <QtGui/QApplication>
#include <QTextCodec>
#include <string>
#include "mainwindow.h"
#include "com/DBSUtil.h"
// for win32 and win64
#ifdef _WIN32
#include <windows.h>
#endif
// all CONSTANTS defined in com/dao/utils.h
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
#ifdef _WIN32
qDebug() << "OS is WINDOWS\n" ;
#ifdef UNICODE
#include <cwchar>
#define convertToULong wcstoul
#else
#include <cstdlib>
#define convertToULong strtoul
#endif // UNICODE
UINT uLayouts;
const UINT uLength = 512;
HKL *lpList = NULL;
TCHAR szBuf[uLength];;
uLayouts = GetKeyboardLayoutList(0, NULL);
lpList = (HKL*)LocalAlloc(LPTR, (uLayouts * sizeof(HKL)));
uLayouts = GetKeyboardLayoutList(uLayouts, lpList);
for(UINT i = 0; i < uLayouts; ++i)
{
GetLocaleInfo(MAKELCID(((UINT)lpList & 0xffffffff),SORT_DEFAULT), LOCALE_ILANGUAGE, szBuf, uLength);
UINT uLID = convertToULong(szBuf,NULL,16);
//wprintf(TEXT("%s %uld %08x \n"), szBuf, ((UINT)lpList & 0xffffffff), uLID);
if((uLID & 0x3FF) == LANG_ARABIC)
{
ActivateKeyboardLayout(lpList,KLF_REORDER);
wprintf(TEXT(" Arabic Locale Found\n"));
}
memset(szBuf, 0, uLength);
}
if(lpList)
LocalFree(lpList);
#endif // _WIN32
//DBSUtil dbs;
//if(!dbs.testConnection())// test connection
// return 1;
MainWindow wind;
wind.setWindowState(Qt::WindowMaximized);
wind.show();
return a.exec();
}بالتوفيق
﴿وَمَا كَانَ اللَّهُ لِيُعَذِّبَهُمْ وَأَنْتَ فِيهِمْ ۚ وَمَا كَانَ اللَّهُ مُعَذِّبَهُمْ وَهُمْ يَسْتَغْفِرُونَ﴾
الأنفال ۳۳
المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية
جارٍ التحقق من المتواجدين…